:root {
    --border-color: #ddd;
    --background-light: #f9f9f9;
    --background-dark: #f0f0f0;
    --primary-color: #007bff;
    --text-color: #333;
    --shadow-light: rgba(0,0,0,0.1);
}

body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-light);
    color: var(--text-color);
    height: 100%;
    overflow: hidden;
}

/* --- Login Bereich --- */
#login-bereich {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--background-dark);
}

.login-box {
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-light);
    text-align: center;
    width: 300px;
}

.login-box h1 {
    margin-bottom: 24px;
    color: var(--text-color);
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.login-box button:hover {
    background-color: #0056b3;
}

/* --- Haupt-Container --- */
#haupt-container {
    display: flex;
    height: 100vh;
}

/* --- Aufgaben Bereich --- */
#aufgaben-bereich {
    width: 80%; /* Default width is now 80% */
    min-width: 350px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding: 20px 20px 0 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
    transition: width 0.3s ease-in-out;
}

#table-scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px; /* Restore bottom padding */
}

/* Compact view state */
#aufgaben-bereich.compact-view {
    width: 40%;
}

#aufgaben-bereich.compact-view .col-projekt,
#aufgaben-bereich.compact-view .col-bezeichnung,
#aufgaben-bereich.compact-view .col-status,
#aufgaben-bereich.compact-view .col-inhalt {
    /* These core columns are always visible */
}

#aufgaben-bereich.compact-view .col-datum,
#aufgaben-bereich.compact-view .col-mitarbeiter,
#aufgaben-bereich.compact-view .col-zeit,
#aufgaben-bereich.compact-view .col-aktion {
    display: none;
}

#aufgaben-bereich.compact-view .col-ansprechperson,
#aufgaben-bereich.compact-view .col-telefon,
#aufgaben-bereich.compact-view .col-email {
     /* By default, contact columns are visible in compact view now */
    display: none;
}

.aufgaben-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header-buttons {
    display: flex;
    gap: 8px;
}

#aufgaben-bereich h2 {
    margin-top: 0;
    margin-bottom: 0;
    color: var(--text-color);
}

#toggle-view-btn, #toggle-columns-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    padding: 6px 10px;
    color: #555;
    line-height: 1;
    transition: background-color 0.2s, color 0.2s;
}
#toggle-view-btn:hover, #toggle-columns-btn:hover {
    background-color: #f0f0f0;
    color: #000;
}

#aufgaben-tabelle {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

#aufgaben-tabelle thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#aufgaben-tabelle th, #aufgaben-tabelle td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    position: relative;
}

#aufgaben-tabelle td[data-label="Projekt"] {
    position: relative;
}

.edit-project-btn {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #555;
    font-size: 0.8em;
    padding: 4px;
}
#aufgaben-tabelle tr:hover .edit-project-btn {
    display: inline-block;
}
.edit-project-btn:hover {
    color: var(--primary-color);
}

#aufgaben-tabelle td[data-label="Bezeichnung"] {
    cursor: default;
}

/* Edit container for task description */
.edit-container {
    display: flex;
    align-items: flex-start;
    gap: 5px;
}
.edit-textarea {
    flex-grow: 1;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 4px;
    font-family: inherit;
    font-size: inherit;
    resize: vertical;
    min-height: 40px;
    box-sizing: border-box;
}
.edit-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.edit-buttons button {
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}
.edit-buttons button.save-edit-btn {
    color: #28a745;
}
.edit-buttons button.cancel-edit-btn {
    color: #dc3545;
}
.edit-buttons button:hover {
    background-color: #f0f0f0;
}

.edit-cell-btn, .edit-tender-cell-btn, .edit-file-cell-btn {
    display: none;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #555;
    font-size: 0.8em;
    padding: 4px;
    background-color: rgba(255,255,255,0.7);
    border-radius: 3px;
    z-index: 2; /* Ensure it's above the subtask button */
}
#aufgaben-tabelle td:not(.editing):hover > .edit-cell-btn,
.tender-table td:not(.editing):hover > .edit-tender-cell-btn,
.file-table td:not(.editing):hover > .edit-file-cell-btn {
    display: inline-block;
}
.edit-cell-btn:hover, .edit-tender-cell-btn:hover, .edit-file-cell-btn:hover {
    color: var(--primary-color);
}

#aufgaben-tabelle th {
    background-color: var(--background-light);
    cursor: pointer;
    user-select: none;
}
#aufgaben-tabelle th:hover {
    background-color: #e0e0e0;
}
#aufgaben-tabelle th i {
    margin-left: 5px;
    color: #999;
}

#filter-zeile td {
    padding: 5px 8px;
    background-color: #f8f9fa;
}

#filter-zeile input, #filter-zeile select {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.9em;
}

#aktionen-kopf {
    text-align: center;
    position: relative;
}

#aktionen-menue-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 4px 8px;
    color: #555;
}

#aktionen-menue-btn:hover {
    color: #000;
}

.aktionen-dropdown {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1001; /* Above status dropdown */
    border-radius: 4px;
    padding: 5px 0;
    border: 1px solid var(--border-color);
}

#add-tab-dropdown {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1001;
    border-radius: 4px;
    padding: 5px 0;
    border: 1px solid var(--border-color);
}

.aktionen-dropdown a {
    color: black;
    padding: 8px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
}

.aktionen-dropdown a:hover {
    background-color: #f1f1f1;
}

.aktionen-dropdown a i {
    margin-right: 8px;
    width: 14px; /* Align icons nicely */
    text-align: center;
}

#aufgaben-tabelle tbody tr.active-task {
    background-color: #d6eaff; /* Light blue for active task */
}
#aufgaben-tabelle tbody tr:not(#neue-aufgabe-zeile):hover {
    background-color: #e9ecef;
}
#aufgaben-tabelle tbody tr.active-task:hover {
    background-color: #cce4ff; /* Slightly darker hover for active task */
}

#neue-aufgabe-zeile {
    background-color: var(--background-light);
}

#neue-aufgabe-zeile input, #neue-aufgabe-zeile select {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

#neue-aufgabe-zeile .column-set-2 input {
    font-size: 0.9em; /* Smaller font for contact details */
}

#hinzufuegen-btn {
    padding: 6px 10px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#hinzufuegen-btn:hover {
    background-color: #218838;
}

.row-actions-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 4px 8px;
    color: #555;
    border-radius: 4px;
    line-height: 1;
}
.row-actions-btn:hover {
    background-color: #e0e0e0;
    color: #000;
}

.delete-btn {
    color: #dc3545;
    cursor: pointer;
    font-size: 1.2em;
    text-align: center;
    transition: color 0.2s;
}
.delete-btn:hover {
    color: #c82333;
}

.status-dot {
    height: 15px;
    width: 15px;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    border: none;
}
.status-dot.green { background-color: #28a745; }
.status-dot.orange { background-color: #fd7e14; }
.status-dot.red { background-color: #dc3545; }

.status-dropdown {
    display: none;
    position: absolute;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 5px var(--shadow-light);
    z-index: 1000;
    padding: 5px;
}
.status-option {
    padding: 5px;
    cursor: pointer;
}
.status-option:hover {
    background-color: var(--background-light);
}

.project-edit {
    width: calc(100% - 10px); /* Adjust to fit within cell padding */
    padding: 4px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
}

.datepicker-edit, .zeit-edit-input, .text-simple-edit-input {
    width: calc(100% - 10px); /* Adjust to fit within cell padding */
    padding: 4px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
}

/* --- Arbeits Bereich --- */
#arbeits-bereich {
    flex: 1; /* Allows this panel to grow and shrink to fill available space */
    display: flex;
    flex-direction: column;
    position: relative; /* For overlay positioning */
    background-color: var(--background-light); /* Added background color */
}

#workspace-tabs-container {
    display: flex;
    align-items: center;
    padding: 5px 10px 0 10px;
    background-color: var(--background-dark);
    border-bottom: 1px solid var(--border-color);
}

#workspace-tabs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-grow: 1;
    overflow-x: auto;
}

#workspace-tabs li {
    padding: 8px 12px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    position: relative;
    bottom: -1px;
    background-color: #e9ecef;
    border-radius: 4px 4px 0 0;
    margin-right: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#workspace-tabs li:hover {
    background-color: #f1f3f5;
}

#workspace-tabs li.active-tab {
    background-color: var(--background-light);
    border-color: var(--border-color);
}

#workspace-tabs .tab-title {
    padding: 2px;
}

#workspace-tabs .tab-title-input {
    border: 1px solid var(--primary-color);
    border-radius: 3px;
    padding: 1px;
    font-family: inherit;
    font-size: inherit;
}

#workspace-tabs .delete-tab-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.9em;
    padding: 2px 4px;
    border-radius: 50%;
    line-height: 1;
}

#workspace-tabs .delete-tab-btn:hover {
    color: #dc3545;
    background-color: #f8d7da;
}

#add-tab-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    padding: 4px 8px;
    margin-left: 10px;
    color: #555;
}
#add-tab-btn:hover {
    background-color: #e9ecef;
    color: #000;
}

#toolbar {
    padding: 10px;
    background-color: var(--background-dark);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

#toolbar button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}
#toolbar button:hover {
    background-color: #e9ecef;
}
#toolbar i {
    margin-right: 8px;
}

#arbeitsflaeche {
    flex-grow: 1;
    position: relative;
    overflow: hidden; /* Hide overflow of draggable items */
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.draggable-text, .draggable-image {
    position: absolute;
    cursor: default; /* Change default cursor since drag is handled */
    border: 1px dashed transparent;
    background: rgba(255, 255, 255, 0.8);
    padding: 0; /* Padding is now on child elements */
    transition: border-color 0.2s;
    box-sizing: border-box; /* Ensure padding/border are inside */
}

.drag-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.05);
    cursor: move;
    z-index: 100;
}

/* Visual cue for the drag handle */
.drag-handle::after {
    content: '...';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(0, 0, 0, 0.3);
    font-size: 24px;
    letter-spacing: 2px;
}

.draggable-text:hover, .draggable-image:hover {
    border-color: #aaa;
}
.draggable-image.drawing-enabled:hover {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path fill='rgba(0,0,0,0.8)' d='M18.363 3.414l-1.414 1.414-2.828-2.828 1.414-1.414a2 2 0 0 1 2.828 0l2.828 2.828a2 2 0 0 1 0 2.828l-1.414 1.414-2.828-2.828 1.414-1.414zm-3.535 3.536l-9.899 9.899-2.829 2.828-2.121-2.121 2.828-2.829 9.9-9.899 2.121 2.121z'/></svg>") 8 16, crosshair;
}

.delete-item-btn {
    display: none; /* Hide by default */
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background-color: #dc3545;
    color: white;
    border: 1px solid white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 101; /* Above the item itself */
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    padding: 0;
}

.workspace-item-selected .delete-item-btn {
    display: flex; /* Show on selected items */
    align-items: center;
    justify-content: center;
}

.draggable-text .text-editor, .draggable-image img {
    padding: 10px; /* Apply padding here instead of parent */
    box-sizing: border-box;
}

.draggable-text .text-editor {
    margin-top: 20px; /* Make space for the handle */
    height: calc(100% - 20px); /* Adjust height for handle */
}

.draggable-image img {
    margin-top: 20px; /* Make space for the handle */
    height: calc(100% - 20px); /* Adjust height for handle */
}

.draggable-text textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
}
.draggable-text .text-editor {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    box-sizing: border-box;
    overflow-y: auto;
    cursor: text;
    padding: 2px;
}
.draggable-text .text-editor:focus {
    outline: none;
}
.draggable-image img {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Zeichen Overlay --- */
#zeichen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
}
#zeichen-canvas {
    cursor: crosshair;
    position: absolute;
    top: 0;
    left: 0;
}
#zeichen-controls {
    position: absolute;
    top: 50px; /* Below toolbar */
    right: 10px;
    z-index: 101;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 5px;
}
#zeichen-controls .zeichen-control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}
#zeichen-controls input[type="color"] {
    border: 1px solid var(--border-color);
    padding: 0;
    width: 30px;
    height: 25px;
    background: none;
    cursor: pointer;
}
#zeichen-controls button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
}
#zeichen-controls button#save-drawing-btn {
    background-color: #28a745;
    color: white;
}
#zeichen-controls button#cancel-drawing-btn {
    background-color: #dc3545;
    color: white;
}

/* --- Text Format Toolbar --- */
.text-format-toolbar {
    position: absolute;
    top: -35px; /* Position above the text box */
    left: 0;
    background-color: white;
    border-radius: 5px;
    padding: 4px 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid #ddd;
    opacity: 0;
    transition: opacity 0.2s, top 0.2s;
    pointer-events: none;
}

.draggable-text.workspace-item-selected .text-format-toolbar {
    opacity: 1;
    top: -40px;
    pointer-events: auto;
}

.text-format-toolbar .format-btn {
    background: none;
    color: #333;
    border: none;
    border-radius: 3px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    line-height: 28px;
    padding: 0;
    transition: background-color 0.2s;
}
.text-format-toolbar .format-btn:hover {
    background: #f0f0f0;
}
.text-format-toolbar .format-color-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    cursor: pointer;
    position: relative;
    border-radius: 3px;
    transition: background-color 0.2s;
}
.text-format-toolbar .format-color-label:hover {
    background: #f0f0f0;
}
.text-format-toolbar .format-color-label i {
    color: #333;
    pointer-events: none; /* Allows click to go to input */
}
.text-format-toolbar .format-input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* Hide the input, label is the UI */
    cursor: pointer;
}

/* Wrapper for select dropdowns in toolbar */
.format-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 3px;
    padding-left: 5px;
}
.format-select-wrapper i {
    color: #333;
    font-size: 14px;
    margin-right: 3px;
}
.format-select-wrapper .format-select {
    background: transparent;
    border: none;
    padding: 4px 2px;
    font-size: 12px;
    cursor: pointer;
}
.format-select-wrapper .format-select:focus {
    outline: none;
}

/* --- Delete Confirmation Bubble --- */
#delete-bubble {
    position: absolute;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-light);
    padding: 10px 15px;
    z-index: 1050;
    text-align: center;
}
#delete-bubble p {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    white-space: nowrap;
}
#delete-bubble button {
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    margin: 0 5px;
    font-size: 0.9em;
}
#delete-bubble .confirm-delete-btn {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}
#delete-bubble .confirm-delete-btn:hover {
    background-color: #c82333;
}
#delete-bubble .cancel-delete-btn {
    background-color: #f0f0f0;
}
#delete-bubble .cancel-delete-btn:hover {
    background-color: #e0e0e0;
}

/* Placeholder for new images */
.image-placeholder {
    border: 2px dashed #999;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default !important;
}
.image-placeholder-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    align-items: center;
    position: relative;
    width: 100%;
}
.image-placeholder-controls select, .image-placeholder-controls button {
    width: calc(100% - 20px);
    padding: 8px;
    box-sizing: border-box;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.image-placeholder-controls button {
    cursor: pointer;
    background: white;
}
.image-placeholder-controls button.upload-btn-placeholder {
    background-color: #f0f0f0;
}
.image-placeholder-controls button.cancel-image-add-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    padding: 0;
    line-height: 24px;
    text-align: center;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    border: none;
}

/* JQuery UI Override */
.ui-resizable-handle {
    background: var(--primary-color);
    border: 1px solid white;
    width: 10px;
    height: 10px;
    z-index: 90;
}
.ui-resizable-e {
    cursor: col-resize;
    width: 7px;
    right: -5px;
    top: 50%;
    height: 100%;
    margin-top: -38px; /* Adjust to center vertically */
    background: none;
    border: none;
}
.ui-datepicker {
    z-index: 1100 !important;
}

/* Add Tab Dialog styling */
.ui-dialog-titlebar-close {
    display: none;
}
#add-tab-dialog {
    text-align: center;
}
#add-tab-dialog .ui-button {
    margin: 10px;
    font-size: 1em;
    padding: 10px 20px;
}

/* --- DEPRECATED_DIALOG_STYLES --- */
/*
#add-tab-dialog {
    text-align: center;
}
#add-tab-dialog .ui-button {
    margin: 10px;
    font-size: 1em;
    padding: 10px 20px;
}
*/
/* --- END DEPRECATED --- */

/* Additional styles */
.col-inhalt {
    width: 40px;
    text-align: center !important;
}

.content-indicator-active {
    color: var(--primary-color);
}

.content-indicator-inactive {
    color: #ccc;
}

.add-subtask-btn {
    display: none;
    position: absolute;
    left: 2px;
    bottom: -10px;
    transform: translateY(-50%);
    cursor: pointer;
    color: white;
    background-color: var(--primary-color);
    font-size: 0.8em;
    font-weight: bold;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

#aufgaben-tabelle tr:hover .add-subtask-btn {
    display: block;
}

.add-subtask-btn:hover {
    background-color: #0056b3;
}

.subtask-row td:first-child {
    padding-left: 25px !important;
    color: #555;
}

.subtask-row {
    background-color: #f8f9fa;
}

.subtask-input-row td {
    background-color: #e9ecef;
}

.subtask-input-row td:first-child {
    padding-left: 12px;
}

.subtask-input-row .save-subtask-btn, .subtask-input-row .cancel-subtask-btn {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    margin-right: 4px;
}
.subtask-input-row .save-subtask-btn {
    background-color: #28a745;
    color: white;
}
.subtask-input-row .cancel-subtask-btn {
    background-color: #dc3545;
    color: white;
}

/* --- Tender List View --- */
.tender-list-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tender-table {
    width: 100%;
    border-collapse: collapse;
}

.tender-table th, .tender-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    position: relative; /* For positioning edit icon */
}

.tender-table thead {
    background-color: var(--background-dark);
}

.tender-table thead th {
    cursor: pointer;
    user-select: none;
}
.tender-table thead th:hover {
    background-color: #e0e0e0;
}

.tender-table .filter-zeile td {
    background-color: #f8f9fa;
    padding: 4px 8px;
}

.tender-table .filter-zeile input, .tender-table .filter-zeile select {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.9em;
}

.tender-table tfoot .neue-ausschreibung-zeile {
    background-color: #f8f9fa;
}

.tender-table tfoot input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.tender-table tfoot .add-tender-btn {
    padding: 6px 10px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tender-table .delete-tender-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #dc3545;
    font-size: 1.1em;
}
.tender-table .delete-tender-btn:hover {
    color: #c82333;
}

/* --- File List View --- */
.file-list-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th, .file-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    position: relative;
}

.file-table thead {
    background-color: var(--background-dark);
}

.file-table thead th {
    cursor: pointer;
    user-select: none;
}
.file-table thead th:hover {
    background-color: #e0e0e0;
}

.file-table .filter-zeile td {
    background-color: #f8f9fa;
    padding: 4px 8px;
}

.file-table .filter-zeile input, .file-table .filter-zeile select {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.9em;
}

.file-table tfoot .neue-datei-zeile {
    background-color: #f8f9fa;
}

.file-table tfoot input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.file-table tfoot .add-file-btn {
    padding: 6px 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.file-table tfoot .add-file-btn:hover {
    background-color: #0056b3;
}

.file-table .delete-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #dc3545;
    font-size: 1.1em;
}
.file-table .delete-file-btn:hover {
    color: #c82333;
}
.file-table .preview-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    font-size: 1.1em;
    margin-right: 8px;
}
.file-table .preview-file-btn:hover {
    color: var(--primary-color);
}

/* --- Message List View --- */
.message-list-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.new-message-btn {
    padding: 8px 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
    align-self: flex-start;
}
.new-message-btn:hover {
    background-color: #0056b3;
}
.new-message-btn i {
    margin-right: 8px;
}

.message-table {
    width: 100%;
    border-collapse: collapse;
}

.message-table th, .message-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    position: relative;
}

.message-table thead {
    background-color: var(--background-dark);
}

.message-table thead th {
    cursor: pointer;
    user-select: none;
}
.message-table thead th:hover {
    background-color: #e0e0e0;
}

.message-table .filter-zeile td {
    background-color: #f8f9fa;
    padding: 4px 8px;
}

.message-table .filter-zeile input, .message-table .filter-zeile select {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.9em;
}

.message-table .delete-message-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #dc3545;
    font-size: 1.1em;
}

.message-table .message-content {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- New Message Composer --- */
.new-message-composer {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 450px;
    max-width: 90vw;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.15);
    z-index: 2100;
    display: flex;
    flex-direction: column;
}

.composer-header {
    background-color: var(--background-dark);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    cursor: default;
}

.composer-close-btn {
    background: none;
    border: none;
    font-size: 1em;
    color: #555;
    cursor: pointer;
    padding: 2px 4px;
}
.composer-close-btn:hover {
    color: #000;
}

.composer-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.composer-subject {
    width: 100%;
    padding: 8px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
    box-sizing: border-box;
    font-size: 1em;
}
.composer-subject:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

.composer-toolbar {
    padding: 5px;
    border-bottom: 1px solid #eee;
}
/* Composer uses a simplified version of the main toolbar */
.composer-toolbar.text-format-toolbar {
    position: static;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    border: none;
    padding: 0;
    top: auto; /* Reset positioning properties */
    transition: none; /* Reset transition */
}

.composer-message {
    min-height: 150px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 8px;
    border: none;
    font-size: 1em;
    line-height: 1.5;
}
.composer-message:focus {
    outline: none;
}

.composer-attachments {
    padding: 5px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.attachment-pill {
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.attachment-pill .remove-attachment-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 1em;
    padding: 0;
}
.attachment-pill .remove-attachment-btn:hover {
    color: #343a40;
}

.composer-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.composer-footer .send-message-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}
.composer-footer .send-message-btn:hover {
    background-color: #0056b3;
}

.composer-footer .attach-file-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    color: #555;
    cursor: pointer;
    padding: 4px;
}
.composer-footer .attach-file-btn:hover {
    color: #000;
}

/* --- Mobile Responsive Styles --- */
#close-workspace-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 15px;
    z-index: 1002; /* Above tab bar */
    background-color: rgba(0,0,0,0.4);
    color: white;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    line-height: 32px;
    text-align: center;
    padding: 0;
}
#close-workspace-btn:hover {
    background-color: rgba(0,0,0,0.6);
}

@media (max-width: 400px) {
    body.mobile-view #haupt-container {
        display: block; /* Stack panels instead of side-by-side */
    }

    body.mobile-view #aufgaben-bereich {
        width: 100%;
        height: 100vh;
        border-right: none;
        padding: 10px 10px 0 10px; /* Adjust padding for small screens */
    }
    
    /* Make resizer handle invisible on mobile */
    body.mobile-view #aufgaben-bereich .ui-resizable-e {
        display: none;
    }

    body.mobile-view #arbeits-bereich {
        width: 100%;
        height: 100vh;
        position: absolute; /* Take it out of flow to overlay */
        top: 0;
        left: 0;
        z-index: 2000; /* Ensure it's on top */
    }

    /* Default mobile state: show tasks, hide workspace */
    body.mobile-view:not(.mobile-workspace-active) #aufgaben-bereich {
        display: flex;
    }
    body.mobile-view:not(.mobile-workspace-active) #arbeits-bereich {
        display: none;
    }

    /* Workspace active state on mobile */
    body.mobile-view.mobile-workspace-active #aufgaben-bereich {
        display: none;
    }
    body.mobile-view.mobile-workspace-active #arbeits-bereich {
        display: flex;
    }
    
    /* Show close button only when workspace is active on mobile */
    body.mobile-view.mobile-workspace-active #close-workspace-btn {
        display: block;
    }
}