/* ==========================================================================
   TEXFLOW ERP — Forms & filters
   ========================================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px 16px;
}
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.form-group { min-width: 0; }
.form-group.span-2 { grid-column: span 2; }

.form-group label,
.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 5px;
}
.form-group .hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}
.req { color: var(--red); }

.input,
input[type="text"].input,
input[type="email"].input,
input[type="password"].input,
input[type="date"].input,
input[type="number"].input,
select.input,
textarea.input {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 80px; line-height: 1.55; }

.input:hover { border-color: var(--muted-2); }
.input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
.input::placeholder { color: var(--muted-2); }
.input:disabled,
.input[readonly] { background: var(--surface-sunken); color: var(--muted); cursor: not-allowed; }

select.input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.input-group { display: flex; }
.input-group .input { border-radius: var(--r) 0 0 var(--r); }
.input-group .addon {
    display: inline-flex;
    align-items: center;
    padding: 0 11px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 var(--r) var(--r) 0;
    background: var(--surface-sunken);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

/* filter bar above tables */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.filters .f-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
    display: block;
}
.filters .input { height: 32px; font-size: 12.5px; }

.search-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
    min-width: 220px;
}
.search-inline:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.13); }
.search-inline input { border: 0; outline: 0; width: 100%; font-size: 13px; background: none; }
.search-inline svg { width: 15px; height: 15px; stroke: var(--muted); fill: none; stroke-width: 1.9; flex: none; }

/* checkbox & radio */
.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
}
.check input[type="checkbox"],
.check input[type="radio"] {
    width: 15px; height: 15px;
    accent-color: var(--blue);
    margin: 0;
    flex: none;
    cursor: pointer;
}

/* segmented radio control (CSS-only state) */
.segment {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface);
    position: relative;
}
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment label {
    padding: 6px 13px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-right: 1px solid var(--border);
}
.segment label:last-of-type { border-right: 0; }
.segment label:hover { background: var(--surface-alt); color: var(--text); }
.segment input:nth-of-type(1):checked ~ label:nth-of-type(1),
.segment input:nth-of-type(2):checked ~ label:nth-of-type(2),
.segment input:nth-of-type(3):checked ~ label:nth-of-type(3),
.segment input:nth-of-type(4):checked ~ label:nth-of-type(4),
.segment input:nth-of-type(5):checked ~ label:nth-of-type(5) {
    background: var(--navy);
    color: #fff;
}

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    width: 34px; height: 20px;
    border-radius: var(--r-pill);
    background: var(--border-strong);
    position: relative;
    transition: background .15s;
    flex: none;
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform .15s;
}
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* settings rows */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .s-title { font-size: 13px; font-weight: 600; }
.setting-row .s-desc { font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 62ch; }

/* login */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface);
}
.auth-side {
    background: var(--navy);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-image:
        radial-gradient(900px 420px at 12% 8%, rgba(37, 99, 235, .28), transparent 62%),
        radial-gradient(700px 380px at 88% 88%, rgba(124, 58, 237, .22), transparent 60%);
}
.auth-form-col {
    display: grid;
    place-items: center;
    padding: 40px 24px;
}
.auth-card { width: 100%; max-width: 372px; }
.auth-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-card h1 { font-size: 22px; margin-bottom: 5px; }
.auth-card .a-sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.auth-meta { font-size: 12px; color: var(--muted); text-align: center; margin-top: 18px; }

.auth-feature {
    display: flex;
    gap: 12px;
    padding: 12px 0;
}
.auth-feature .f-ico {
    width: 32px; height: 32px;
    border-radius: var(--r);
    background: rgba(255, 255, 255, .10);
    display: grid;
    place-items: center;
    flex: none;
    color: #93C5FD;
}
.auth-feature .f-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-feature .f-t { display: block; font-size: 13px; font-weight: 600; color: #fff; }
.auth-feature .f-d { display: block; font-size: 12px; color: #94A3B8; margin-top: 1px; }

.auth-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding-top: 20px;
}
.auth-stats .as-v { font-size: 19px; font-weight: 700; color: #fff; }
.auth-stats .as-k { font-size: 11px; color: #94A3B8; }
