/* Vardiya Yonetim Sistemi - v1 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.nav-links a:hover {
    background: var(--bg);
}

.nav-links a.active {
    background: var(--primary);
    color: white;
}

.user-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-control {
    cursor: pointer;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    white-space: nowrap;
}

tr:hover td {
    background: #f1f5f9;
}

/* Schedule grid */
.week-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.week-nav h2 {
    font-size: 1.1rem;
    flex: 1;
    min-width: 200px;
}

.schedule-table th.day-col {
    text-align: center;
    min-width: 100px;
}

.schedule-table td {
    text-align: center;
    vertical-align: middle;
}

.schedule-table select {
    width: 100%;
    min-width: 90px;
    padding: 0.35rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.schedule-table .person-name {
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.schedule-table .dept-name {
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.shift-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.shift-standard {
    background: #dbeafe;
    color: #1e40af;
}

.shift-1 {
    background: #dcfce7;
    color: #166534;
}

.shift-2 {
    background: #fef3c7;
    color: #92400e;
}

.shift-3 {
    background: #ede9fe;
    color: #5b21b6;
}

.shift-off {
    background: #f1f5f9;
    color: var(--text-muted);
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.stat-box .number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-box .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Print */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        font-size: 9pt;
    }

    .site-header,
    footer {
        display: none !important;
    }

    .schedule-sheet-wrap {
        border: none;
        border-radius: 0;
    }

    .official-sheet {
        padding: 0;
        min-width: 0;
    }

    .official-table {
        font-size: 7pt;
    }

    .official-table .col-no {
        width: 16px !important;
    }

    .official-table .col-name {
        width: 14% !important;
    }

    .official-table .col-duty {
        width: 8% !important;
    }

    .official-table .legend-codes {
        overflow: hidden !important;
        padding: 1px 2px !important;
    }

    .legend-codes-inner {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 1px 2px !important;
        box-sizing: border-box !important;
    }

    .legend-codes .code-box {
        font-size: 4.2pt !important;
        padding: 0.5px 1.5px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        line-height: 1.08 !important;
        box-sizing: border-box !important;
        letter-spacing: -0.015em;
    }

    .legend-codes .code-box-stack {
        font-size: 3.8pt !important;
        white-space: normal !important;
        padding: 0.5px 1px !important;
        line-height: 1.05 !important;
    }

    .legend-codes .code-box-stack .code-line {
        white-space: nowrap !important;
    }

    .official-table .legend-label {
        font-size: 5.5pt;
        padding-left: 0.25rem !important;
    }

    .official-table tbody .col-no {
        font-size: 6.5pt;
        padding: 1px 0 !important;
    }

    .official-table tbody .col-name {
        font-size: 6.5pt;
        padding: 2px 3px !important;
    }

    .official-table .col-shift {
        font-size: 7pt;
        padding: 2px !important;
    }

    .official-table .legend-row th {
        overflow: hidden !important;
    }

    .official-sheet .signature-box .sig-title {
        font-size: 7pt;
        margin-bottom: 14px;
    }

    .official-sheet .signature-box .sig-name {
        font-size: 7pt;
        min-width: 120px;
    }

    .official-table .legend-row th,
    .official-table .header-row th,
    .official-table .col-fixed {
        background: #d9d9d9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .official-sheet.v2 .cell-no,
    .official-sheet.v2 .cell-name,
    .official-sheet.v2 .cell-duty,
    .official-sheet.v2 .cell-mesai,
    .official-sheet.v2 .cell-v1,
    .official-sheet.v2 .cell-v2,
    .official-sheet.v2 .cell-v3,
    .official-sheet.v2 .cell-off,
    .official-sheet.v2 .cell-rt,
    .official-sheet.v2 .cell-leave,
    .official-sheet.v2 .cell-leave-m,
    .official-sheet.v2 .cell-leave-yi,
    .official-sheet.v2 .hdr-no,
    .official-sheet.v2 .hdr-name,
    .official-sheet.v2 .hdr-duty,
    .official-sheet.v2 .hdr-day {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge-role {
    background: #dbeafe;
    color: #1e40af;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* ===== Birlesik Vardiya Cizelgesi ===== */

.schedule-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toolbar-title h1 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    max-width: 520px;
}

.toolbar-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
}

.status-ok {
    background: #dcfce7;
    color: #166534;
}

.status-warn {
    background: #fef3c7;
    color: #92400e;
}

.status-version {
    background: #dbeafe;
    color: #1d4ed8;
}

.schedule-sheet-wrap {
    background: #fff;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 0;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    container-type: inline-size;
    container-name: schedule-sheet;
}

/* ===== Resmi Calisma Plani Sablonu ===== */
.official-sheet {
    padding: 1.25rem 1rem 1rem;
    min-width: min(100%, 920px);
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #111;
}

.sheet-title {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    line-height: 1.35;
    margin-bottom: 0.75rem;
    padding: 0 1rem;
}

.sheet-week-range {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
    padding: 0 0.15rem;
}

.official-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.72rem;
}

.official-table th,
.official-table td {
    border: 1px solid #222;
    text-align: center;
    vertical-align: middle;
    padding: 0;
}

/* Kodlar satiri */
.official-table .legend-row th {
    background: #d9d9d9;
    padding: 0.35rem 0.25rem;
    font-weight: 600;
    vertical-align: middle;
}

.official-table .legend-label {
    text-align: left;
    padding-left: 0.4rem !important;
    font-size: clamp(0.55rem, 1.1vw, 0.68rem);
    white-space: nowrap;
    width: auto;
    vertical-align: middle;
}

.official-table .legend-codes {
    text-align: left;
    padding: 0.2rem 0.15rem !important;
    overflow: hidden;
    max-width: 100%;
}

.legend-codes-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.1rem 0.15rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.legend-codes .code-box {
    display: inline-block;
    border: 1px solid #222;
    background: #fff;
    padding: 0.06rem 0.18rem;
    margin: 0;
    font-size: clamp(0.42rem, 0.62vw, 0.54rem);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1.1;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
}

.legend-codes .code-box-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: normal;
    padding: 0.05rem 0.12rem;
    line-height: 1.05;
    font-size: clamp(0.38rem, 0.55vw, 0.48rem);
}

.legend-codes .code-box-stack .code-line {
    display: block;
    white-space: nowrap;
}

@container schedule-sheet (max-width: 920px) {
    .legend-codes .code-box {
        font-size: clamp(0.42rem, 0.65vw, 0.52rem);
        padding: 0.06rem 0.18rem;
    }
}

@container schedule-sheet (max-width: 780px) {
    .legend-codes .code-box {
        font-size: 0.42rem;
        letter-spacing: -0.01em;
    }

    .official-table tbody .col-name,
    .official-table .hdr-name {
        font-size: 0.6rem;
    }
}

/* Baslik satiri */
.official-table .header-row th {
    background: #d9d9d9;
    font-weight: 700;
    font-size: clamp(0.58rem, 1vw, 0.68rem);
    padding: 0.3rem 0.15rem;
    vertical-align: middle;
}

.official-table .hdr-no {
    font-size: clamp(0.52rem, 0.9vw, 0.62rem);
    padding: 0.25rem 0.05rem !important;
    letter-spacing: -0.02em;
}

.official-table .col-no {
    width: 24px;
}

.official-table .col-name {
    width: 19%;
}

.official-table .col-duty {
    width: 9%;
}

.official-table .col-day {
    width: auto;
}

.official-table .col-day .hdr-date {
    display: block;
    font-size: clamp(0.48rem, 0.8vw, 0.58rem);
    font-weight: 600;
    margin-bottom: 1px;
}

.official-table .col-day .hdr-day {
    display: block;
    font-size: clamp(0.55rem, 0.9vw, 0.68rem);
    font-weight: 700;
}

/* Sabit sutunlar (gri arka plan) */
.official-table .col-fixed {
    background: #d9d9d9;
    font-weight: 600;
}

.official-table tbody .col-name,
.official-table tbody .col-duty {
    text-align: center;
    padding: 0.3rem 0.35rem !important;
    font-size: clamp(0.58rem, 0.95vw, 0.65rem);
    line-height: 1.2;
    word-break: break-word;
}

.official-table tbody .col-name {
    text-align: left;
}

.official-table tbody .col-no {
    padding: 0.25rem 0 !important;
    font-size: clamp(0.58rem, 0.9vw, 0.68rem);
    font-weight: 700;
    line-height: 1.1;
}

/* Vardiya hucreleri */
.official-table .col-shift {
    background: #fff;
    padding: 0.28rem 0.1rem !important;
    min-height: 26px;
    font-size: clamp(0.55rem, 0.85vw, 0.65rem);
    font-weight: 600;
}

.official-table .cell-value {
    display: block;
    line-height: 1.2;
}

.official-table .shift-select {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: clamp(0.5rem, 0.75vw, 0.58rem);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0.2rem 0;
}

.official-table .shift-select:focus {
    outline: 2px solid #2563eb;
    background: #eff6ff;
}

.official-table .shift-cell-edit {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-items: stretch;
}

.official-table .shift-manual-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
}

.official-table .shift-time-input {
    width: 100%;
    max-width: 4.2rem;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #fff;
    font-size: clamp(0.45rem, 0.65vw, 0.52rem);
    font-weight: 600;
    font-family: inherit;
    padding: 0.1rem 0.05rem;
    text-align: center;
}

.official-table .shift-time-input:focus {
    outline: 2px solid #2563eb;
    border-color: #2563eb;
}

.official-table .shift-time-sep {
    font-size: 0.5rem;
    color: #64748b;
    flex-shrink: 0;
}

.official-table tbody tr:hover .col-shift {
    background: #fafafa;
}

/* Imza alani */
.official-sheet .signature-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.75rem;
    padding: 0 0.5rem;
}

.official-sheet .signature-box {
    text-align: center;
}

.official-sheet .signature-box .sig-title {
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
}

.official-sheet .signature-box .sig-name {
    font-size: 0.78rem;
    font-weight: 700;
    border-top: 1px solid #222;
    display: inline-block;
    min-width: 160px;
    padding-top: 0.35rem;
}

/* ===== v2 Renkli Tema ===== */
.official-sheet.v2 .sheet-title {
    color: #1e3a5f;
    font-size: 1rem;
}

.official-sheet.v2 .sheet-week-range .version-tag {
    font-size: 0.65rem;
    background: #2563eb;
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.official-sheet.v2 .legend-row th {
    background: linear-gradient(180deg, #e8eef5 0%, #d4dce8 100%);
}

.official-sheet.v2 .legend-label {
    background: #5b7cba !important;
    color: #fff !important;
}

.official-sheet.v2 .code-box.lc-m  { background: #fef3c7; border-color: #d97706; color: #92400e; }
.official-sheet.v2 .code-box.lc-yi { background: #dbeafe; border-color: #2563eb; color: #1e40af; }
.official-sheet.v2 .code-box.lc-ui { background: #f3e8ff; border-color: #9333ea; color: #6b21a8; }
.official-sheet.v2 .code-box.lc-r  { background: #fee2e2; border-color: #dc2626; color: #991b1b; }
.official-sheet.v2 .code-box.lc-rt { background: #fecaca; border-color: #b91c1c; color: #7f1d1d; }
.official-sheet.v2 .code-box.lc-g  { background: #d1fae5; border-color: #059669; color: #065f46; }
.official-sheet.v2 .code-box.lc-di { background: #fce7f3; border-color: #db2777; color: #9d174d; }
.official-sheet.v2 .code-box.lc-ei { background: #fdf2f8; border-color: #ec4899; color: #831843; }

.official-sheet.v2 .hdr-no   { background: #3b82f6 !important; color: #fff !important; }
.official-sheet.v2 .hdr-name { background: #0d9488 !important; color: #fff !important; }
.official-sheet.v2 .hdr-duty { background: #7c3aed !important; color: #fff !important; }
.official-sheet.v2 .hdr-day  { background: #475569 !important; color: #fff !important; }

.official-sheet.v2 .hdr-day-name { display: block; font-size: 0.68rem; font-weight: 700; }

.official-sheet.v2 .row-tone-1 .cell-no   { background: #bfdbfe !important; color: #1e3a8a; font-weight: 800; }
.official-sheet.v2 .row-tone-1 .cell-name { background: #99f6e4 !important; color: #115e59; font-weight: 700; }
.official-sheet.v2 .row-tone-1 .cell-duty { background: #ddd6fe !important; color: #5b21b6; font-weight: 600; }

.official-sheet.v2 .row-tone-2 .cell-no   { background: #93c5fd !important; color: #1e3a8a; font-weight: 800; }
.official-sheet.v2 .row-tone-2 .cell-name { background: #5eead4 !important; color: #134e4a; font-weight: 700; }
.official-sheet.v2 .row-tone-2 .cell-duty { background: #c4b5fd !important; color: #4c1d95; font-weight: 600; }

.official-sheet.v2 .row-tone-3 .cell-no   { background: #7dd3fc !important; color: #0c4a6e; font-weight: 800; }
.official-sheet.v2 .row-tone-3 .cell-name { background: #2dd4bf !important; color: #134e4a; font-weight: 700; }
.official-sheet.v2 .row-tone-3 .cell-duty { background: #a78bfa !important; color: #3b0764; font-weight: 600; }

.official-sheet.v2 .row-tone-4 .cell-no   { background: #bae6fd !important; color: #0c4a6e; font-weight: 800; }
.official-sheet.v2 .row-tone-4 .cell-name { background: #99f6e4 !important; color: #115e59; font-weight: 700; }
.official-sheet.v2 .row-tone-4 .cell-duty { background: #e9d5ff !important; color: #581c87; font-weight: 600; }

.official-sheet.v2 .cell-mesai    { background: #dbeafe !important; color: #1d4ed8; }
.official-sheet.v2 .cell-v1       { background: #dcfce7 !important; color: #15803d; }
.official-sheet.v2 .cell-v2       { background: #fef9c3 !important; color: #a16207; }
.official-sheet.v2 .cell-v3       { background: #ede9fe !important; color: #6d28d9; }
.official-sheet.v2 .cell-off      { background: #f1f5f9 !important; color: #64748b; font-style: italic; }
.official-sheet.v2 .cell-rt       { background: #fecaca !important; color: #b91c1c; font-weight: 800; }
.official-sheet.v2 .cell-leave    { background: #fce7f3 !important; color: #be185d; }
.official-sheet.v2 .cell-leave-m  { background: #fef3c7 !important; color: #b45309; }
.official-sheet.v2 .cell-leave-yi { background: #dbeafe !important; color: #1d4ed8; }
.official-sheet.v2 .cell-leave-ui { background: #f3e8ff !important; color: #7e22ce; }
.official-sheet.v2 .cell-leave-r  { background: #fee2e2 !important; color: #dc2626; }
.official-sheet.v2 .cell-leave-g  { background: #d1fae5 !important; color: #047857; }
.official-sheet.v2 .cell-leave-di { background: #fbcfe8 !important; color: #be185d; }
.official-sheet.v2 .cell-leave-ei { background: #fdf2f8 !important; color: #db2777; }

.official-sheet.v2 .shift-select.cell-off  { background: #f1f5f9 !important; }
.official-sheet.v2 .shift-select.cell-mesai { background: #dbeafe !important; }
.official-sheet.v2 .shift-select.cell-v1   { background: #dcfce7 !important; }
.official-sheet.v2 .shift-select.cell-v2   { background: #fef9c3 !important; }
.official-sheet.v2 .shift-select.cell-v3   { background: #ede9fe !important; }

.official-sheet.v2 tbody tr:hover .col-shift {
    filter: brightness(0.97);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: #f8fafc;
    border-top: 1px solid #cbd5e1;
    font-size: 0.68rem;
}

.color-legend .cl-item {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid rgba(0,0,0,0.12);
}

.official-sheet.v2 tbody tr.row-me .cell-no,
.official-sheet.v2 tbody tr.row-me .cell-name,
.official-sheet.v2 tbody tr.row-me .cell-duty {
    box-shadow: inset 0 0 0 2px #2563eb;
    font-weight: 800;
}

.official-sheet.v2 tbody tr.row-me .col-shift {
    box-shadow: inset 0 0 0 2px #2563eb;
}

.schedule-sheet-wrap {
    box-shadow: 0 4px 20px rgba(30, 58, 95, 0.12);
    border-color: #94a3b8;
}

.print-header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.print-header h1 {
    font-size: 1rem;
    letter-spacing: 0.02em;
    line-height: 1.35;
    max-width: 95%;
    margin: 0 auto;
}

.print-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.print-header .print-meta {
    font-size: 0.7rem;
}

/* v4 Stok Modulu */
.stock-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stock-subnav a {
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.88rem;
}

.stock-subnav a:hover {
    background: var(--bg);
}

.stock-subnav a.active {
    background: var(--primary);
    color: #fff;
}

.stock-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-heading {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}

.section-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--border);
}

.stock-section {
    margin-bottom: 1.75rem;
}

.stock-section:last-child {
    margin-bottom: 0;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.stat-card.stat-warning { border-left: 4px solid var(--warning); }
.stat-card.stat-info { border-left: 4px solid var(--primary); }
.stat-card.stat-danger { border-left: 4px solid var(--danger); }

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.75rem;
    line-height: 1.2;
}

.card-alert {
    border-left: 4px solid var(--warning);
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-full {
    grid-column: 1 / -1;
}

.row-low-stock {
    background: #fef2f2 !important;
}

.row-urgent {
    background: #fff7ed !important;
}

.row-inactive {
    opacity: 0.55;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-secondary { background: #e2e8f0; color: #475569; }

.text-danger { color: var(--danger); font-weight: 600; }
.text-success { color: var(--success); font-weight: 600; }

.material-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.material-thumb-empty {
    color: var(--text-muted);
}

.material-card-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Malzeme karti — varsayilan (masaustu) */
.material-card-layout {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 1.25rem;
    align-items: flex-start;
}

.material-card-photo {
    flex: 0 0 auto;
    width: 72px;
    min-width: 72px;
}

.material-card-specs {
    flex: 1 1 auto;
    min-width: 0;
}

.material-card-name {
    font-size: 1.15rem;
    margin: 0 0 0.75rem;
    color: var(--text);
}

.material-spec-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1.25rem;
    margin: 0;
}

.material-card-alert {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.material-card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Masaustu — genis rahat gorunum */
.stock-app.device-desktop .material-card-layout {
    gap: 2rem;
}

.stock-app.device-desktop .material-card-photo {
    width: 72px;
    min-width: 72px;
}

.stock-app.device-desktop .material-image {
    width: 72px;
    height: 72px;
    max-height: 72px;
    object-fit: cover;
}

.stock-app.device-desktop .material-image-placeholder {
    width: 72px;
    height: 72px;
    min-height: 72px;
}

.stock-app.device-desktop .material-card-name {
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

.stock-app.device-desktop .material-spec-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 2rem;
}

.stock-app.device-desktop .material-spec-list dt {
    font-size: 0.78rem;
}

.stock-app.device-desktop .material-spec-list dd {
    font-size: 1rem;
}

.stock-app.device-desktop .material-spec-list .spec-highlight dd {
    font-size: 1.2rem;
}

/* Mobil — resim solda, yazilar sagda (yan yana) */
.stock-app.device-mobile .material-card-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
}

.stock-app.device-mobile .material-card-photo {
    width: 72px;
    min-width: 72px;
    flex-shrink: 0;
}

.stock-app.device-mobile .material-image {
    width: 72px;
    height: 72px;
    max-height: 72px;
    object-fit: cover;
}

.stock-app.device-mobile .material-image-placeholder {
    width: 72px;
    height: 72px;
    min-height: 72px;
    aspect-ratio: 1;
    font-size: 0.62rem;
    padding: 0.2rem;
}

.stock-app.device-mobile .material-image-placeholder .placeholder-icon {
    font-size: 1.25rem;
}

.stock-app.device-mobile .material-card-name {
    font-size: 0.92rem;
    margin-bottom: 0.45rem;
    line-height: 1.25;
}

.stock-app.device-mobile .material-spec-list {
    grid-template-columns: 1fr;
    gap: 0.3rem;
}

.stock-app.device-mobile .material-spec-list dt {
    font-size: 0.62rem;
    line-height: 1.2;
}

.stock-app.device-mobile .material-spec-list dd {
    font-size: 0.8rem;
    line-height: 1.25;
}

.stock-app.device-mobile .material-spec-list .spec-highlight dd {
    font-size: 0.9rem;
}

.stock-app.device-mobile .material-card-alert {
    margin-top: 0.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
}

.stock-app.device-mobile .spec-mobile-hide {
    display: none;
}

.stock-app.device-mobile .spec-desktop-only {
    display: none;
}

.stock-app.device-desktop .spec-mobile-only {
    display: none;
}

.material-spec-list .spec-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.material-spec-list .spec-full {
    grid-column: 1 / -1;
}

.material-spec-list dt {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.material-spec-list dd {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.material-spec-list .spec-highlight dd {
    font-size: 1.1rem;
}

.material-image {
    width: 72px;
    height: 72px;
    max-height: 72px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.material-image-placeholder {
    width: 72px;
    height: 72px;
    min-height: 72px;
    aspect-ratio: 1;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.material-image-placeholder .placeholder-icon {
    font-size: 1rem;
    opacity: 0.6;
}

.material-form-card {
    margin-bottom: 1.25rem;
}

.material-form-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.material-form-image {
    flex: 0 0 auto;
}

.material-form-image label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.material-form-fields {
    flex: 1 1 280px;
    min-width: 0;
}

.stock-page-block {
    margin-bottom: 2rem;
}

.stock-page-block-list {
    margin-bottom: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.material-list-card {
    margin-top: 0;
}

.stock-image-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stock-image-buttons .btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.45rem;
    white-space: nowrap;
}

.stock-image-hint {
    display: none;
}

.material-image-quick-upload {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.card-title-sm {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

/* Resim yukleme — kamera / galeri */
.stock-image-upload {
    max-width: 88px;
}

.stock-image-preview-wrap {
    margin-bottom: 0.5rem;
}

.stock-image-preview {
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.stock-image-preview-empty {
    width: 72px;
    height: 72px;
    background: var(--bg);
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stock-image-preview-empty .preview-icon {
    font-size: 1rem;
    opacity: 0.5;
}

.stock-image-hint {
    display: none;
}

.inline-actions {
    display: inline;
}

.order-actions {
    display: inline-block;
}

.order-status-form {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius);
    min-width: 180px;
}

.order-status-form .form-control {
    margin-bottom: 0.35rem;
}

.rules-summary {
    padding-left: 1.25rem;
    line-height: 1.8;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.print-table th,
.print-table td {
    border: 1px solid #333;
    padding: 0.35rem 0.5rem;
    text-align: left;
}

.print-table th {
    background: #f1f5f9;
}

.print-form-table th {
    width: 35%;
}

.print-alert {
    background: #fef3c7;
    border: 1px solid #d97706;
    padding: 0.5rem 0.75rem;
    margin: 1rem 0;
    font-weight: 600;
}

.print-signatures {
    display: flex;
    justify-content: space-around;
    margin-top: 3rem;
    gap: 2rem;
}

.print-signature {
    text-align: center;
    min-width: 140px;
}

.print-signature .sig-line {
    border-bottom: 1px solid #333;
    height: 2rem;
    margin-bottom: 0.35rem;
}

.print-signature span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.print-material-card {
    margin: 1rem 0;
}

/* Stok modulu mobil uyum (.stock-app) */
.stock-app .container {
    padding: 0 0.75rem;
}

.stock-app .site-header .container {
    position: relative;
}

.stock-app .stock-nav-toggle {
    display: none;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.45rem 0.65rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.stock-app .stock-subnav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.stock-app .stock-subnav-links {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
}

.stock-app .stock-subnav a {
    white-space: nowrap;
    flex-shrink: 0;
}

.device-indicator {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    white-space: nowrap;
}

.device-indicator.device-mobile-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.device-indicator.device-desktop-badge {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.stock-app .stock-toolbar {
    flex-direction: column;
    align-items: stretch;
}

.stock-app .toolbar-actions {
    width: 100%;
}

.stock-app .toolbar-actions .form-control,
.stock-app .inline-form select {
    width: 100%;
}

.stock-app .stats-grid {
    grid-template-columns: repeat(2, 1fr);
}

.stock-app .card-grid-3 {
    grid-template-columns: 1fr;
}

.stock-app .form-grid-2 {
    grid-template-columns: 1fr;
}

.stock-app .stock-image-upload {
    max-width: 100%;
}

.stock-app .stock-image-preview,
.stock-app .stock-image-preview-wrap {
    max-width: 100%;
}

.stock-app .stock-image-buttons {
    flex-direction: column;
}

.stock-app .stock-image-buttons .btn {
    width: 100%;
    justify-content: center;
}

.stock-app .order-status-form {
    min-width: 0;
    width: 100%;
}

@media (max-width: 768px) {
    .stock-app .stock-nav-toggle {
        display: inline-flex;
    }

    .stock-app .site-header .container {
        flex-wrap: wrap;
    }

    .stock-app .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        order: 3;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border);
    }

    .stock-app .nav-links.nav-open {
        display: flex;
    }

    .stock-app .nav-links a {
        width: 100%;
    }

    .stock-app .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
    }

    .stock-app .stat-value {
        font-size: 1.4rem;
    }

    .stock-app .page-heading {
        font-size: 1.15rem;
    }

    /* Tablolari mobil kart gorunumune cevir */
    .stock-app .stock-table-responsive thead {
        display: none;
    }

    .stock-app .stock-table-responsive tbody tr {
        display: block;
        margin-bottom: 0.85rem;
        padding: 0.75rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--card);
    }

    .stock-app .stock-table-responsive tbody tr.row-low-stock {
        border-left: 4px solid var(--danger);
    }

    .stock-app .stock-table-responsive tbody tr.row-urgent {
        border-left: 4px solid var(--warning);
    }

    .stock-app .stock-table-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.35rem 0;
        border: none;
        text-align: right;
    }

    .stock-app .stock-table-responsive tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.78rem;
        color: var(--text-muted);
        text-align: left;
        flex: 0 0 42%;
    }

    .stock-app .stock-table-responsive tbody td.no-print::before {
        content: 'İşlem';
    }

    .stock-app .stock-table-wrap {
        overflow: visible;
    }

    .stock-app .inline-actions,
    .stock-app .inline-actions form {
        display: block;
        width: 100%;
        margin-bottom: 0.35rem;
    }

    .stock-app .inline-actions .btn {
        width: 100%;
    }

    .stock-app.device-mobile .material-card-actions {
        flex-direction: column;
    }

    .stock-app.device-mobile .material-card-actions .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stock-app .stats-grid {
        grid-template-columns: 1fr;
    }
}

.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.demirbas-app .demirbas-subnav {
    margin-bottom: 1rem;
}

.asset-code-line {
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.asset-history-card {
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .card-grid-2 {
        grid-template-columns: 1fr;
    }
}
