/* CSS variables for consistent, premium Muji Minimalist & Elegant styling */
:root {
    --bg-body: #faf7f2;       /* Warm sand / Off-white background */
    --bg-panel: #ffffff;      /* Crisp white for cards/panels */
    --bg-panel-light: #f5ebe0;/* Soft cream beige for sub-containers */
    --bg-input: #fdfcfb;      /* Clean ivory for input fields */
    
    --border-color: #e5d9cc;  /* Soft paper/wood beige borders */
    --border-focus: #c5a07c;  /* Soft Oak wood border on focus */
    
    --text-main: #4a433e;     /* Muji charcoal/dark brown (less harsh than black) */
    --text-muted: #8c8177;    /* Warm stone grey for captions */
    --text-white: #2e2621;    /* Deep bark brown for bold headings */
    
    /* Muji Pastel Color Scheme */
    --color-emerald: #6b8f71;       /* Sage Green (Ready status) */
    --color-emerald-light: #eaf0eb;
    --color-mint: #537559;
    
    --color-gold: #c29d78;          /* Light Oak Wood (Primary buttons) */
    --color-gold-hover: #ae8b64;
    --color-gold-light: #f9f4ed;
    
    --color-crimson: #c86b5c;       /* Terracotta Rust (Urgent/Dirty status) */
    --color-crimson-light: #faf0ee;
    
    --color-amber: #cf9b61;         /* Ochre Yellow (Cleaning status) */
    --color-amber-light: #faf4eb;
    
    --color-blue: #6d8ba6;          /* Slate Denim Blue (Occupied status) */
    --color-blue-light: #edf2f6;
    
    --color-purple: #8e809c;        /* Soft Lavender (Maintenance status) */
    --color-purple-light: #f1eff4;
    
    /* Villa statuses mapped to colors */
    --status-ready: var(--color-emerald);
    --status-dirty: var(--color-crimson);
    --status-cleaning: var(--color-amber);
    --status-maintenance: var(--color-purple);
    --status-occupied: var(--color-blue);
    
    --shadow-sm: 0 4px 12px rgba(90, 80, 70, 0.05);
    --shadow-md: 0 10px 25px rgba(90, 80, 70, 0.08);
    --shadow-lg: 0 20px 45px rgba(90, 80, 70, 0.12);
    --transition-speed: 0.22s;
    --border-radius: 10px; /* Cozy, slightly rounded corners */
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Prompt', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    letter-spacing: -0.1px;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: #dcd2c4;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-gold);
}

/* Typography utilities */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-white);
}

.text-emerald { color: var(--color-emerald); }
.text-gold { color: var(--color-gold); }
.text-crimson { color: var(--color-crimson); }
.text-amber { color: var(--color-amber); }
.text-blue { color: var(--color-blue); }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }

.bg-emerald-light { background-color: var(--color-emerald-light); }
.bg-crimson-light { background-color: var(--color-crimson-light); }
.bg-blue-light { background-color: var(--color-blue-light); }
.bg-gold-light { background-color: var(--color-gold-light); }
.bg-amber-light { background-color: var(--color-amber-light); }

.bg-ready { background-color: var(--status-ready); color: #fff !important; }
.bg-dirty { background-color: var(--status-dirty); color: #fff !important; }
.bg-cleaning { background-color: var(--status-cleaning); color: #fff !important; }
.bg-maintenance { background-color: var(--status-maintenance); color: #fff !important; }
.bg-occupied { background-color: var(--status-occupied); color: #fff !important; }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--color-gold);
    color: #ffffff;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(194, 157, 120, 0.25);
    background-color: var(--color-gold-hover);
}

.btn-secondary {
    background-color: var(--bg-panel-light);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: #ede2d5;
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--color-crimson);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #b75e51;
    box-shadow: 0 4px 12px rgba(200, 107, 92, 0.25);
}

.btn-success {
    background-color: var(--color-emerald);
    color: #ffffff;
}
.btn-success:hover {
    background-color: var(--color-mint);
    box-shadow: 0 4px 12px rgba(107, 143, 113, 0.25);
}

.btn-amber {
    background-color: var(--color-amber);
    color: #ffffff;
}
.btn-amber:hover {
    background-color: #be8a51;
}

.btn-blue {
    background-color: var(--color-blue);
    color: white;
}
.btn-blue:hover {
    background-color: #5d7a94;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-gold);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
    font-family: inherit;
}
.btn-text:hover {
    color: var(--color-mint);
}

/* Card base */
.card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-hover {
    transition: all var(--transition-speed) ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-gold);
}

/* Header */
.app-header {
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    height: 70px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.6rem;
    color: var(--color-gold);
}

.logo-text h1 {
    font-size: 1.15rem;
    line-height: 1.1;
    color: var(--text-white);
    letter-spacing: 0.5px;
}

.logo-text span {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Role Selector */
.role-selector-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-body);
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.role-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.custom-select-wrapper {
    position: relative;
}

.role-select {
    background: none;
    border: none;
    color: var(--text-white);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    padding-right: 20px;
    appearance: none;
    -webkit-appearance: none;
}

.custom-select-wrapper::after {
    content: "▼";
    font-size: 0.55rem;
    color: var(--text-muted);
    position: absolute;
    right: 0;
    top: 52%;
    transform: translateY(-50%);
    pointer-events: none;
}

.btn-reset {
    font-size: 0.85rem;
    padding: 8px 14px;
}

/* Layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 250px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    transition: transform var(--transition-speed) ease;
}

.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-user-profile .avatar {
    font-size: 2rem;
    background-color: var(--bg-panel-light);
    width: 46px;
    height: 46px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.sidebar-user-profile .user-info h3 {
    font-size: 0.95rem;
    color: var(--text-white);
}

.sidebar-user-profile .user-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-item:hover {
    color: var(--text-white);
    background-color: var(--bg-panel-light);
}

.nav-item.active {
    color: var(--text-white);
    background-color: var(--bg-panel-light);
    border-left: 3px solid var(--color-gold);
    border-radius: 0 6px 6px 0;
    font-weight: 600;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

/* Content Area */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background-color: var(--bg-body);
}

.content-section {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 22px;
}

.section-header h2 {
    font-size: 1.4rem;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header .subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Stats Overview */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Row-Col Grid System for panels */
.dashboard-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.dashboard-col {
    display: flex;
    flex-direction: column;
}

.col-7 { width: 58%; }
.col-5 { width: 42%; }

.panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    height: 450px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 0.98rem;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body {
    padding: 18px;
    flex: 1;
    overflow-y: auto;
}

.scroll-panel {
    overflow-y: auto;
}

/* Villa Mini Grid */
.villa-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.villa-mini-card {
    background-color: var(--bg-panel-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 105px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.villa-mini-card:hover {
    border-color: var(--color-gold);
    transform: scale(1.02);
}

.mini-villa-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
}

.mini-villa-status {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 6px;
}

.mini-villa-guest {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Tasks simple widgets */
.task-list-simple {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-widget-subheading {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    margin-bottom: 5px;
}

.task-simple-item {
    background-color: var(--bg-panel-light);
    border-left: 3px solid var(--color-gold);
    padding: 12px;
    border-radius: 0 6px 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}
.task-simple-item:hover {
    transform: translateX(2px);
    background-color: #ebdcc9;
}

.task-simple-item.prio-urgent { border-left-color: var(--color-crimson); }
.task-simple-item.prio-high { border-left-color: var(--color-amber); }
.task-simple-item.prio-medium { border-left-color: var(--color-gold); }
.task-simple-item.prio-low { border-left-color: var(--text-muted); }

.task-simple-main h4 {
    font-size: 0.88rem;
    color: var(--text-white);
    margin-bottom: 2px;
}

.task-simple-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-simple-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-muted);
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.empty-state i {
    font-size: 1.6rem;
    opacity: 0.6;
}

/* Villa Status Full Board */
.villa-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background-color: var(--bg-panel);
    padding: 8px 18px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.legend-item {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.villa-full-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.villa-full-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 275px;
    transition: all var(--transition-speed) ease;
}

.villa-full-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-gold);
}

.villa-card-image {
    height: 130px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.villa-card-image::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.05), rgba(0,0,0,0.6));
}

.villa-card-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.villa-card-name {
    position: absolute;
    bottom: 10px;
    left: 14px;
    right: 14px;
    z-index: 5;
}

.villa-card-name h3 {
    font-size: 1.05rem;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.villa-card-content {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.villa-info-row {
    font-size: 0.82rem;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.villa-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.villa-card-actions .btn {
    flex: 1;
}

/* Filters */
.filter-panel {
    margin-bottom: 20px;
}

.filter-group-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.filter-field input, .filter-field select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    font-size: 0.88rem;
}

.filter-field input:focus, .filter-field select:focus {
    border-color: var(--color-gold);
}

/* Tables */
.table-container {
    padding: 0;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.data-table th {
    background-color: var(--bg-panel-light);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background-color: var(--bg-panel-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-todo { background-color: #ededed; color: #6e6e6e; }
.badge-inprogress { background-color: var(--color-amber-light); color: var(--color-amber); border: 1px solid rgba(207, 155, 97, 0.2); }
.badge-review { background-color: var(--color-blue-light); color: var(--color-blue); border: 1px solid rgba(109, 139, 166, 0.2); }
.badge-completed { background-color: var(--color-emerald-light); color: var(--color-emerald); border: 1px solid rgba(107, 143, 113, 0.2); }

.priority-badge { font-weight: 600; }
.prio-badge-urgent { background-color: var(--color-crimson); color: white; }
.prio-badge-high { background-color: var(--color-crimson-light); color: var(--color-crimson); border: 1px solid rgba(200, 107, 92, 0.2); }
.prio-badge-medium { background-color: var(--color-gold-light); color: var(--color-gold); border: 1px solid rgba(194, 157, 120, 0.2); }
.prio-badge-low { background-color: #f0f0f0; color: var(--text-muted); }

/* STAFF BANNER & KANBAN */
.staff-header-banner {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.staff-profile-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.staff-avatar-large {
    font-size: 2.2rem;
    width: 54px;
    height: 54px;
    border-radius: 6px;
    background-color: var(--bg-panel-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.staff-title-text h2 {
    color: var(--text-white);
    font-size: 1.25rem;
}

.staff-title-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.staff-actions {
    display: flex;
    gap: 8px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    align-items: start;
    height: calc(100vh - 210px);
    min-height: 480px;
}

.kanban-column {
    background-color: var(--bg-panel-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.column-header {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.88rem;
    background-color: rgba(255,255,255,0.4);
}

.column-title {
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 6px;
}

.column-count {
    background-color: var(--bg-panel);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.kanban-cards-container {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

/* Kanban Cards */
.kanban-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card:hover {
    transform: translateY(-1px);
    border-color: var(--color-gold);
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-white);
    line-height: 1.3;
}

.kanban-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.kanban-card-villa {
    font-weight: 600;
    color: var(--color-gold);
}

.kanban-card-deadline {
    display: flex;
    align-items: center;
    gap: 3px;
}

.kanban-card-deadline.overdue {
    color: var(--color-crimson);
    font-weight: 600;
}

.kanban-card-checklist-summary {
    font-size: 0.72rem;
    background-color: var(--bg-panel-light);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(60, 50, 40, 0.4); /* warm brownish translucent overlay */
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.22s cubic-bezier(0.1, 1, 0.1, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content {
    width: 100%;
    max-width: 600px;
    background-color: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-panel-light);
}

.modal-header h3 {
    font-size: 1.05rem;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}
.close-btn:hover {
    color: var(--text-white);
}

.modal-body {
    padding: 20px;
}

/* Forms */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.col-12 { width: 100%; }
.col-6 { width: 50%; }

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition-speed);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--border-focus);
}

.required {
    color: var(--color-crimson);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Specific Border for Danger Modals */
.border-danger {
    border: 1px solid var(--color-crimson);
}
.bg-danger {
    background-color: var(--color-crimson-light) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Task Detail Grid */
.task-detail-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 20px;
}

.detail-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-right: 1px solid var(--border-color);
    padding-right: 16px;
}

.detail-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-meta-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background-color: var(--bg-panel-light);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.meta-val {
    font-size: 0.85rem;
    color: var(--text-white);
}

.detail-section h4 {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-desc {
    font-size: 0.88rem;
    background-color: var(--bg-panel-light);
    padding: 10px;
    border-radius: 6px;
    white-space: pre-wrap;
    min-height: 50px;
    border: 1px solid var(--border-color);
}

/* Checklist editor */
.checklist-creator {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.checklist-creator input {
    flex: 1;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
}
.checklist-creator input:focus {
    border-color: var(--color-gold);
}

.checklist-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    background-color: var(--bg-panel-light);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.checklist-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--color-emerald);
}

.checklist-item span {
    flex: 1;
}

.checklist-item.checked span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.btn-delete-checklist {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}
.btn-delete-checklist:hover {
    color: var(--color-crimson);
}

/* Comments history */
.notes-history {
    flex: 1;
    background-color: var(--bg-panel-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    height: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-item {
    font-size: 0.8rem;
    padding: 8px;
    background-color: var(--bg-panel);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.note-item-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-bottom: 2px;
}

.note-item-author {
    font-weight: 600;
    color: var(--text-white);
}

.note-item-text {
    word-break: break-word;
}

.note-input-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-input-container textarea {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.82rem;
    outline: none;
    resize: none;
}
.note-input-container textarea:focus {
    border-color: var(--color-gold);
}

/* Status buttons */
.status-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

/* Helper styles for Drag & Drop hover */
.kanban-cards-container.drag-over {
    background-color: rgba(194, 157, 120, 0.08);
    border: 1px dashed var(--color-gold);
}

/* Requisition Quantity inputs list */
.req-qty-input:focus {
    border-color: var(--color-gold) !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }
    
    .app-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px 20px;
    }
    
    .sidebar-user-profile {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        padding: 5px 0;
        overflow-x: auto;
        gap: 8px;
    }
    
    .nav-item {
        padding: 6px 12px;
        white-space: nowrap;
        border-radius: 6px;
    }
    .nav-item.active {
        border-left: none;
        border-bottom: 3px solid var(--color-gold);
        border-radius: 6px 6px 0 0;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
        height: auto;
        gap: 15px;
    }
    
    .kanban-column {
        height: 380px;
    }
    
    .dashboard-row {
        flex-direction: column;
    }
    
    .col-7, .col-5 {
        width: 100%;
    }
    
    .panel {
        height: auto;
        max-height: 420px;
    }
    
    .app-content {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 10px;
        align-items: center;
    }
    
    .role-selector-container {
        width: 100%;
        justify-content: center;
    }
    
    .btn-reset {
        width: 100%;
    }
    
    .task-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-left {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-group.col-6 {
        width: 100%;
    }
}
