:root {
    --primary: #5BA4CF;
    --primary-light: #90C4E4;
    --primary-dark: #3A7CA5;
    --secondary: #7A9AB5;
    --success: #52B788;
    --warning: #F4A261;
    --danger: #E07A7A;
    --bg-main: #EFF6FB;
    --bg-sidebar: #2D4F6C;
    --text-main: #2C3E50;
    --text-muted: #7A9AB5;
    --card-bg: #ffffff;
    --border-color: #C8DFF0;
    --sidebar-text: #B8D4E8;
    --sidebar-active: #ffffff;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 4px 0 rgb(91 164 207 / 0.1);
    --shadow-md: 0 4px 12px -1px rgb(91 164 207 / 0.15), 0 2px 6px -2px rgb(91 164 207 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
}

.logo {
    padding: 0 24px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.logo-icon {
    color: var(--primary-light);
}

.nav-menu {
    flex-grow: 1;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-item.active {
    background-color: rgba(144, 196, 228, 0.2);
    color: var(--sidebar-active);
    border-right: 4px solid var(--primary-light);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item * {
    pointer-events: none;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.monthly-summary {
    padding: 0 0 12px;
}

.monthly-summary:last-child {
    padding-bottom: 0;
}

.monthly-summary small {
    display: block;
    color: var(--sidebar-text);
    opacity: 0.7;
    margin-bottom: 4px;
    font-size: 0.75rem;
}

.time-display {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.content-header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #F7FBFE;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

/* Filter */
.filter-container {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    gap: 8px;
}

.filter-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.filter-select {
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    padding-right: 8px;
}

/* Voice Input Button */
.input-with-action {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.btn-voice {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-voice:hover {
    background-color: var(--bg-main);
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-voice.recording {
    background-color: var(--danger);
    color: white;
    border-color: var(--danger);
    animation: pulse 1.5s infinite;
}

/* Client List Styles */
.client-add-form {
    margin: 24px 0;
}

.client-list {
    list-style: none;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
}

.client-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.client-item:hover {
    background-color: var(--bg-main);
}

.client-name {
    font-weight: 500;
}

.btn-delete-client {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.btn-delete-client:hover {
    color: var(--danger);
}

.input-with-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-label .input-field {
    width: 100px;
}

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-outline {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-main);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #c96060;
}

/* Settings: data transfer */
.data-transfer-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 24px 0;
}

.transfer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.transfer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.transfer-info strong {
    font-size: 0.95rem;
    color: var(--text-main);
}

.transfer-info span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.import-label {
    cursor: pointer;
    white-space: nowrap;
}

.import-status {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.import-status.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.import-status.error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.import-status.hidden {
    display: none;
}

.danger-zone {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 8px;
}

.danger-zone h3 {
    font-size: 0.85rem;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Views */
.view {
    padding: 40px;
    animation: fadeIn 0.3s ease-out;
}

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

.hidden {
    display: none !important;
}

/* Task Columns */
.task-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.task-column h2 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.todo { background-color: var(--secondary); }
.status-dot.ongoing { background-color: var(--warning); }
.status-dot.done { background-color: var(--success); }

.count {
    background-color: #DDF0FA;
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 200px;
}

/* Task Card */
.task-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: default;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.task-card h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    padding-right: 20px;
    font-weight: 600;
}

.task-card .client-badge {
    display: inline-block;
    padding: 2px 8px;
    background-color: #DDF0FA;
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.task-timer {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.task-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon i {
    width: 14px;
    height: 14px;
}

.btn-icon:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}

.btn-icon.delete:hover {
    color: var(--danger);
}

.btn-icon.timer-btn.running {
    background-color: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Report & Stats Cards */
.card {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

.report-card h2, .stats-card h2 {
    margin-bottom: 12px;
}

.report-controls {
    display: flex;
    gap: 12px;
    margin: 24px 0;
}

.input-field {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
}

.report-textarea {
    width: 100%;
    height: 300px;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
    resize: none;
    background-color: var(--bg-main);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 32px 0;
}

.stat-item {
    background-color: var(--bg-main);
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.stat-item .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-item .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border-radius: var(--radius-lg);
    width: 500px;
    max-width: 90vw;
    animation: slideUp 0.3s ease-out;
}

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

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

.close-btn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

#task-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group .input-field {
    width: 100%;
}

.history-table tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.history-table tr:hover {
    background-color: var(--bg-main);
}

.history-table td {
    padding: 12px 8px;
}

.history-table .text-right {
    text-align: right;
}

.btn-edit-client {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    margin-right: 12px;
}

.btn-edit-client:hover {
    color: var(--primary);
}

/* Batch Registration Panel */
.batch-modal-content {
    width: min(900px, 95vw);
    max-height: 85vh;
    overflow-y: auto;
}

.batch-panel {
    margin-top: 32px;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.batch-panel-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border-color);
    background-color: #F7FBFE;
}

.batch-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.batch-panel-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.batch-table-wrap {
    overflow-x: auto;
    padding: 0 24px;
}

.batch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 16px 0;
}

.batch-table thead tr {
    border-bottom: 2px solid var(--border-color);
}

.batch-table th {
    padding: 8px 6px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.batch-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
}

.batch-table tbody tr:hover {
    background-color: var(--bg-main);
}

.batch-table td {
    padding: 8px 6px;
    vertical-align: middle;
}

.batch-input {
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    min-width: 0;
}

.batch-table .input-with-action {
    min-width: 180px;
}

.batch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: #F7FBFE;
}

/* Pricing Menus */
.client-item-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.pricing-menus {
    background-color: var(--bg-main);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pricing-menu-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    padding: 4px 0;
}

.menu-label-text {
    flex: 1;
    font-weight: 500;
}

.menu-type-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}

.menu-type-badge.hourly {
    background-color: #DDF0FA;
    color: var(--primary-dark);
}

.menu-type-badge.fixed {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.menu-price-text {
    font-weight: 600;
    color: var(--text-main);
    min-width: 70px;
    text-align: right;
}

.menu-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    padding: 2px 0 4px;
}

.menu-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.menu-add-row .input-field {
    flex: 1;
    min-width: 80px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.menu-type-select {
    max-width: 130px;
}

.menu-add-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Spot Records */
.spot-record-card {
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.spot-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 20px 0 0;
}

.spot-input-row .input-field {
    flex: 1;
    min-width: 100px;
}

.spot-list {
    list-style: none;
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
}

.spot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.spot-item:hover {
    background-color: var(--bg-main);
}

.spot-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.spot-desc {
    font-size: 0.9rem;
    font-weight: 500;
}

.spot-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.spot-empty {
    padding: 16px 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* =====================
   Hamburger Button
   ===================== */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    flex-shrink: 0;
}

.hamburger-btn i {
    width: 18px;
    height: 18px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
}

.sidebar-overlay.active {
    display: block;
}

/* =====================
   Mobile Responsive
   ===================== */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    /* Sidebar becomes a fixed drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 200;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content full width */
    .main-content {
        width: 100%;
        overflow-y: visible;
        height: auto;
    }

    /* Header */
    .content-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
        position: sticky;
        top: 0;
    }

    .header-left {
        gap: 10px;
        flex: 1;
        min-width: 0;
    }

    .content-header h1 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hamburger-btn {
        display: flex;
    }

    .header-actions {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    /* Smaller buttons on mobile */
    .header-actions .btn {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    /* Filter container compact */
    .filter-container {
        padding: 4px 8px;
    }

    /* View padding */
    .view {
        padding: 16px;
    }

    /* Task columns: single column */
    .task-sections {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Task list height */
    .task-list {
        min-height: 80px;
    }

    /* Stats grid: single column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 16px 0;
    }

    .stat-item .value {
        font-size: 1.5rem;
    }

    /* Cards full width */
    .card {
        max-width: 100%;
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }

    /* Report */
    .report-controls {
        flex-direction: column;
        gap: 8px;
    }

    .report-output-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .report-textarea {
        height: 220px;
    }

    /* Spot input */
    .spot-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .spot-input-row .input-field,
    .spot-input-row .input-with-label {
        width: 100%;
    }

    .spot-input-row #add-spot-btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal */
    .modal-content {
        width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Batch panel */
    .batch-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .batch-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Client cards */
    .menu-add-row {
        flex-direction: column;
        align-items: stretch;
    }

    .menu-add-row .input-field,
    .menu-add-row .input-with-label,
    .menu-add-btn {
        width: 100%;
    }

    /* Sidebar footer compact */
    .sidebar-footer {
        padding: 16px;
    }

    /* Settings transfer items */
    .transfer-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .transfer-item .btn,
    .transfer-item .import-label {
        width: 100%;
        justify-content: center;
    }
}

/* ─── Modal Tabs ─────────────────────────────────────────────── */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin: 0 -24px 20px;
    padding: 0 24px;
    gap: 4px;
}

.modal-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.modal-tab:hover:not(.active) {
    color: var(--text-main);
}

/* ─── Modal Template Panel ───────────────────────────────────── */
#modal-template-panel {
    margin-bottom: 8px;
}

.tpl-modal-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    background: var(--bg-main);
    transition: box-shadow 0.15s;
}

.tpl-modal-card:hover {
    box-shadow: var(--shadow-sm);
}

.tpl-modal-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.tpl-modal-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.tpl-modal-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tpl-use-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 7px 14px;
}

/* ─── Template Management (clients view) ────────────────────── */
.templates-card {
    margin-top: 24px;
}

.template-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: 16px;
}

.template-form-row {
    display: flex;
    gap: 12px;
}

.template-form-row .form-group {
    flex: 1;
}

.tpl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    background: var(--card-bg);
}

.tpl-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.tpl-title {
    font-weight: 700;
    font-size: 0.9rem;
}

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

/* ─── Stats Client Groups ────────────────────────────────────── */
.stats-client-group {
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.stats-client-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
}

.stats-client-name {
    font-weight: 700;
    font-size: 1rem;
}

.stats-client-subtotal {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    font-weight: 700;
}

.stats-client-reward {
    color: #ffe08a;
}

.stats-task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.stats-task-table thead tr {
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.stats-task-table th {
    padding: 8px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
}

.stats-task-row td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.stats-task-row:last-child td {
    border-bottom: none;
}

.stats-task-row:nth-child(even) {
    background: var(--bg-main);
}

@media (max-width: 768px) {
    .template-form-row {
        flex-direction: column;
    }

    .tpl-modal-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .tpl-use-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-client-subtotal {
        flex-direction: column;
        gap: 2px;
        align-items: flex-end;
    }
}
