:root {
    --bg: #fafafa;
    --bg-soft: #ffffff;
    --surface: rgba(255, 255, 255, 0.95);
    --surface-strong: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.08), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px rgba(0, 0, 0, 0.12), 0 12px 20px rgba(0, 0, 0, 0.06);
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --secondary: #ea580c;
    --danger: #dc2626;
    --accent-a: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    --accent-b: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    --accent-c: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --accent-d: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    --accent-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background: 
        radial-gradient(circle at top left, rgba(13, 148, 136, 0.07), transparent 35%),
        radial-gradient(circle at bottom right, rgba(234, 88, 12, 0.07), transparent 30%),
        var(--bg);
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 28px 22px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: var(--shadow-lg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #06d6a0 100%);
    color: #fff;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    box-shadow: 0 8px 16px rgba(13, 148, 136, 0.3);
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.eyebrow,
.muted,
small {
    color: var(--muted);
}

.sidebar small {
    color: rgba(255, 255, 255, 0.7);
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-list a {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(248, 250, 252, 0.85);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateX(6px);
}

.main-panel {
    padding: 24px;
}

.main-panel-full {
    grid-column: 1 / -1;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    padding-top: 48px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar h1,
.hero-panel h2,
.section-head h3 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
}

.topbar-card,
.panel,
.alert {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar-card {
    padding: 12px 16px;
    border-radius: 16px;
    text-align: right;
}

.panel {
    border-radius: 20px;
    padding: 28px;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

.hero-panel {
    display: grid;
    gap: 26px;
    grid-template-columns: 1.2fr 1fr;
    min-height: 320px;
    align-items: center;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.92) 50%, 
        rgba(248, 250, 252, 0.88) 100%);
    border-radius: 20px;
    backdrop-filter: blur(20px);
}

.compact-auth {
    margin-top: 8vh;
}

.auth-minimal {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    min-height: auto;
    background: rgba(255, 255, 255, 0.97);
}

.auth-form-compact {
    gap: 14px;
}

.auth-form-compact button {
    margin-top: 6px;
}

.stack-form,
.form-grid,
.inline-form,
.head-actions,
.section-head-wrap,
.action-grid,
.grid-cards,
.two-col-grid {
    display: grid;
    gap: 16px;
}

.stack-form label,
.form-grid label {
    display: grid;
    gap: 8px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

.section-head,
.section-head-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.section-head-wrap,
.head-actions {
    flex-wrap: wrap;
}

.inline-form {
    grid-auto-flow: column;
    align-items: center;
}

input,
textarea,
select {
    width: 100%;
    border-radius: 12px;
    border: 1.5px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.98);
    padding: 12px 16px;
    color: var(--text);
    transition: all 0.2s ease;
    font-size: 1rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
    background: rgba(255, 255, 255, 1);
}

.checkbox-field {
    align-self: end;
    grid-auto-flow: column;
    align-items: center;
    justify-content: start;
}

.checkbox-field input {
    width: auto;
}

.btn,
.button-link {
    border: 0;
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover,
.button-link:hover {
    transform: translateY(-2px);
}

.btn:active,
.button-link:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #0d9488 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.1) 0%, rgba(249, 115, 22, 0.08) 100%);
    color: var(--secondary);
    border: 1px solid rgba(234, 88, 12, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.15) 0%, rgba(249, 115, 22, 0.12) 100%);
    border-color: rgba(234, 88, 12, 0.3);
}

.btn-danger,
.danger-link {
    color: #fff;
    background: linear-gradient(135deg, var(--danger) 0%, #ef4444 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover,
.danger-link:hover {
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.4);
}

.danger-link,
.button-link {
    background: transparent;
    color: var(--danger);
    padding: 0;
    box-shadow: none;
}

.danger-link:hover,
.button-link:hover {
    box-shadow: none;
    opacity: 0.8;
}

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.alert.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.04) 100%);
    border-color: rgba(16, 185, 129, 0.2);
    color: #047857;
}

.alert.error,
.danger-panel {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(220, 38, 38, 0.04) 100%);
    border-color: rgba(220, 38, 38, 0.2);
    color: #991b1b;
}

.text-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.single-line-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
    color: #fff;
    overflow: hidden;
    position: relative;
    border: none !important;
    box-shadow: var(--shadow-lg) !important;
}

.stat-card span,
.stat-card strong {
    position: relative;
    z-index: 1;
}

.stat-card strong {
    display: block;
    margin-top: 18px;
    font-size: 1.8rem;
    font-weight: 700;
}

.accent-a { background: var(--accent-a); }
.accent-b { background: var(--accent-b); }
.accent-c { background: var(--accent-c); }
.accent-d { background: var(--accent-d); }

.two-col-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-content {
    display: grid;
    gap: 22px;
}

.action-tile {
    padding: 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(10, 184, 166, 0.04) 100%);
    display: grid;
    gap: 8px;
    min-height: 120px;
    border: 1px solid rgba(13, 148, 136, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.action-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(13, 148, 136, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.action-tile:hover {
    transform: translateY(-4px);
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.12) 0%, rgba(10, 184, 166, 0.08) 100%);
    box-shadow: var(--shadow-lg);
}

.action-tile strong {
    font-size: 1.1rem;
    color: var(--text);
    position: relative;
    z-index: 1;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid rgba(31, 41, 51, 0.08);
    text-align: left;
    vertical-align: top;
}

thead th {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

thead th.col-product {
    flex: 1;
    min-width: 180px;
    text-align: left;
}

thead th.col-qty {
    width: 80px;
    text-align: center;
}

thead th.col-price {
    width: 100px;
    text-align: right;
}

thead th.col-tax {
    width: 75px;
    text-align: center;
}

thead th.col-total {
    width: 100px;
    text-align: right;
}

thead th.col-action {
    width: 50px;
    text-align: center;
}

.actions-cell {
    display: flex;
    gap: 14px;
    align-items: center;
}

.text-link {
    color: var(--primary-dark);
    font-weight: 700;
}

.helper-card,
.order-total-box,
.search-results,
.search-item {
    border-radius: 18px;
}

.helper-card,
.order-total-box {
    padding: 16px;
    background: rgba(15, 118, 110, 0.06);
}

/* Order total box: grid of label/value pairs */
.order-total-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
    align-items: center;
}

.order-total-box .total-label {
    font-weight: 700;
    font-size: 1.05rem;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 118, 110, 0.2);
    margin-top: 4px;
}

.order-total-box .total-value {
    padding-top: 8px;
    border-top: 1px solid rgba(15, 118, 110, 0.2);
    margin-top: 4px;
    font-size: 1.1rem;
}

/* KDV badge in table cells */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.12) 0%, rgba(10, 184, 166, 0.08) 100%);
    color: var(--primary-dark);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

.badge-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(96, 165, 250, 0.08) 100%);
    color: #1e40af;
    border-color: rgba(59, 130, 246, 0.2);
}

.order-layout {
    align-items: start;
}

.search-results {
    display: grid;
    gap: 10px;
}

.search-item {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.98);
    border: 1.5px solid rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-item strong,
.search-item small {
    display: block;
}

.search-item.active,
.search-item:hover {
    border-color: var(--primary);
    background: rgba(13, 148, 136, 0.04);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.compact-table table td,
.compact-table table th {
    padding: 10px 8px;
}

.order-total-box {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
}

.narrow-panel {
    max-width: 640px;
}

.space-top {
    margin-top: 18px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.bulk-filter-form {
    align-items: end;
}

.bulk-pricing-table-wrap table {
    min-width: 920px;
}

.bulk-price-input {
    min-width: 170px;
}

/* POS Screen Styles */
.order-layout {
    grid-template-columns: 1.1fr 1.2fr;
    gap: 28px;
}

.order-panel,
.summary-panel {
    display: flex;
    flex-direction: column;
}

.order-panel {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(248, 250, 252, 0.95) 100%);
}

.order-panel .section-head {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(13, 148, 136, 0.1);
}

.order-panel label {
    margin-bottom: 6px;
}

.order-panel label span {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 8px;
    display: block;
}

.summary-panel {
    background: linear-gradient(135deg, 
        rgba(13, 148, 136, 0.06) 0%, 
        rgba(10, 184, 166, 0.03) 100%);
    border: 1.5px solid rgba(13, 148, 136, 0.12);
}

.summary-panel .section-head {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(13, 148, 136, 0.2);
}

.summary-panel h3 {
    color: var(--primary-dark);
}

#search-results {
    gap: 12px !important;
    max-height: 360px;
    overflow-y: auto;
    padding: 8px 0;
    margin-bottom: 16px;
}

#search-results::-webkit-scrollbar {
    width: 6px;
}

#search-results::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb {
    background: rgba(13, 148, 136, 0.3);
    border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 148, 136, 0.5);
}

.search-item {
    padding: 16px 16px;
    background: rgba(255, 255, 255, 0.99);
    border: 1.5px solid rgba(13, 148, 136, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    text-align: left;
}

.search-item strong {
    display: block;
    font-size: 0.98rem;
    color: var(--text);
    margin-bottom: 4px;
}

.search-item small {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
}

.search-item.active,
.search-item:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, 
        rgba(13, 148, 136, 0.08) 0%, 
        rgba(10, 184, 166, 0.04) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(13, 148, 136, 0.15);
}

/* Order Summary Table */
#order-lines {
    background: rgba(255, 255, 255, 0.96);
}

#order-lines tr {
    transition: all 0.2s ease;
    border-bottom: 1.5px solid rgba(13, 148, 136, 0.08);
}

#order-lines tr:hover {
    background: rgba(13, 148, 136, 0.04);
}

#order-lines td {
    padding: 14px 10px;
    vertical-align: middle;
}

#order-lines .empty-row {
    text-align: center;
    color: var(--muted);
    font-style: italic;
}

#order-lines .empty-row:hover {
    background: transparent;
}

#order-lines strong {
    font-weight: 700;
    color: var(--text);
}

/* Table Column Specific Styling */
.col-product {
    flex: 1;
    min-width: 180px;
}

.col-product strong {
    font-size: 0.95rem;
}

.col-product small {
    font-size: 0.85rem;
    line-height: 1.3;
}

.col-qty {
    width: 80px;
    text-align: center;
}

.col-qty input {
    width: 70px;
    padding: 8px 8px !important;
    text-align: center;
    font-weight: 600;
    border-radius: 10px;
}

.col-price {
    width: 100px;
    text-align: right;
    padding-right: 14px !important;
    font-weight: 600;
}

.col-tax {
    width: 75px;
    text-align: center;
}

.col-total {
    width: 100px;
    text-align: right;
    padding-right: 14px !important;
    font-weight: 700;
    color: var(--primary-dark);
}

.col-action {
    width: 50px;
    text-align: center;
}

.remove-line {
    background: transparent;
    color: var(--danger);
    font-size: 1.1rem;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-weight: 700;
}

.remove-line:hover {
    color: #991b1b;
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.2);
}

/* Order Total Box */
.order-total-box {
    margin-top: 0 !important;
    padding: 20px 16px;
    background: linear-gradient(135deg, 
        rgba(13, 148, 136, 0.1) 0%, 
        rgba(10, 184, 166, 0.06) 100%);
    border: 1.5px solid rgba(13, 148, 136, 0.2);
    border-radius: 14px;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 16px !important;
    font-size: 1.1rem;
}

.order-total-box span {
    font-weight: 600;
    color: var(--muted);
}

.order-total-box strong {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.order-total-box .total-label {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    font-weight: 700;
    font-size: 1rem;
}

.order-total-box .total-value {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    font-size: 1.2rem;
}

@media (max-width: 1100px) {
    .app-shell,
    .hero-panel,
    .stats-grid,
    .single-line-cards,
    .action-grid,
    .two-col-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .order-layout {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 800px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding-bottom: 12px;
    }

    .main-panel {
        padding: 16px;
    }

    .topbar,
    .section-head,
    .section-head-wrap,
    .head-actions,
    .inline-form,
    .actions-cell,
    .form-actions {
        display: grid;
    }
    }

    /* Order Info Grid */
    .order-info-grid {
        display: grid;
        gap: 12px;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        margin: 20px 0;
    }

    .info-item {
        padding: 12px;
        border-radius: 12px;
        background: rgba(15, 23, 42, 0.02);
        border: 1px solid rgba(15, 23, 42, 0.06);
    }

    .info-label {
        display: block;
        font-size: 0.85rem;
        color: var(--muted);
        margin-bottom: 6px;
    }

    .info-value {
        display: block;
        font-size: 1rem;
        color: var(--text);
    }

    /* Editable Table */
    .editable-table {
        width: 100%;
        border-collapse: collapse;
        margin: 20px 0;
    }

    .editable-table thead {
        background: rgba(15, 23, 42, 0.04);
    }

    .editable-table th {
        padding: 12px 8px;
        text-align: left;
        font-weight: 600;
        color: var(--text);
        border-bottom: 2px solid rgba(15, 23, 42, 0.1);
        font-size: 0.9rem;
    }

    .editable-table td {
        padding: 12px 8px;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    }

    .editable-table tbody tr:hover {
        background: rgba(15, 23, 42, 0.02);
    }

    .col-static {
        color: var(--text);
        font-weight: 500;
    }

    .col-editable input {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 8px;
        font-size: 0.9rem;
    }

    .col-editable input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
    }

    .col-total {
        text-align: right;
        font-weight: 600;
        color: var(--primary-dark);
    }

    .col-action {
        text-align: center;
    }

    .btn-delete-item {
        background: rgba(220, 38, 38, 0.07);
        border: 1px solid rgba(220, 38, 38, 0.2);
        color: #991b1b;
        padding: 8px 12px;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 700;
        transition: all 0.15s ease;
    }

    .btn-delete-item:hover {
        background: rgba(220, 38, 38, 0.15);
        border-color: #dc2626;
        color: #dc2626;
    }

    .form-actions {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }

    .table-wrap {
        overflow-x: auto;
        border-radius: 12px;
        border: 1px solid rgba(15, 23, 42, 0.06);
}