/* ───────── База ───────── */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: #f4f6f8;
    color: #222;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

.screen { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.screen[hidden] { display: none; }

/* Логин */
#screen-login {
    align-items: center; justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(180deg, #16a085 0%, #117a65 100%);
}
.login-box {
    width: 100%; max-width: 380px;
    background: #fff; border-radius: 16px;
    padding: 28px 22px 22px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark { font-size: 32px; font-weight: 800; letter-spacing: 4px; color: #16a085; }
.brand-sub { color: #666; font-size: 14px; margin-top: 4px; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: #555; font-weight: 600; }
.field > span > em { font-style: normal; color: #999; font-weight: 400; }
.field input, .field textarea {
    appearance: none; -webkit-appearance: none;
    border: 1px solid #ccd; background: #fff;
    border-radius: 10px; padding: 12px 14px;
    font-size: 16px; color: #222; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    resize: vertical;
}
.field input:focus, .field textarea:focus {
    outline: none; border-color: #16a085;
    box-shadow: 0 0 0 3px rgba(22,160,133,.18);
}

button { cursor: pointer; font-family: inherit; font-size: 15px; }
button.primary {
    background: #16a085; color: #fff; border: none;
    border-radius: 10px; padding: 14px;
    font-size: 16px; font-weight: 700;
    transition: background .15s;
    width: 100%;
}
button.primary:hover { background: #149077; }
button.primary:active { background: #117a65; }
button.primary:disabled { background: #ccd; color: #fff; cursor: not-allowed; }

button.ghost {
    background: transparent; color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 8px; padding: 8px 14px; font-size: 14px;
}
button.ghost.back-btn { border: none; padding: 8px 4px; font-size: 16px; }

.error {
    background: #ffe3e3; color: #c0392b;
    border-left: 4px solid #c0392b;
    padding: 10px 12px; border-radius: 6px;
    font-size: 14px;
}
.hint { margin-top: 16px; color: #888; font-size: 12px; text-align: center; line-height: 1.5; }
.loading { text-align: center; color: #888; padding: 30px 0; }
.empty { text-align: center; padding: 60px 24px; color: #888; }
.empty-icon { font-size: 44px; margin-bottom: 8px; }
.empty-text { font-size: 17px; font-weight: 600; color: #555; }
.empty-hint { font-size: 13px; margin-top: 4px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: #16a085; color: #fff;
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
}
.topbar-title { line-height: 1.2; flex: 1; text-align: center; }
.t1 { font-size: 12px; opacity: .8; }
.t2 { font-size: 17px; font-weight: 700; }

.tabs {
    display: flex; align-items: stretch;
    background: #fff; border-bottom: 1px solid #e0e3e7;
    padding: 0 8px;
}
.tab {
    flex: 1; background: none; border: none;
    padding: 12px 4px; font-size: 14px; color: #666; font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
}
.tab.active { color: #16a085; border-bottom-color: #16a085; }
.reload-btn {
    background: none; border: none; color: #16a085;
    font-size: 22px; padding: 4px 14px; cursor: pointer;
}

.content { flex: 1; padding: 16px; }
.list-content { padding-bottom: max(16px, env(safe-area-inset-bottom)); }

.req-card {
    background: #fff; border-radius: 12px;
    padding: 14px; margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border-left: 4px solid #16a085;
    cursor: pointer;
    transition: transform .1s, box-shadow .1s;
}
.req-card:active { transform: scale(.98); box-shadow: 0 0 0 2px rgba(22,160,133,.2); }
.req-card.status-new       { border-left-color: #3498db; }
.req-card.status-in_work   { border-left-color: #e67e22; }
.req-card.status-done      { border-left-color: #27ae60; opacity: .85; }
.req-card.status-cancelled { border-left-color: #999; opacity: .7; }

.req-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.req-type { font-size: 12px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: .5px; }
.req-address { font-size: 16px; font-weight: 700; color: #222; margin-bottom: 4px; }
.req-breakdown { color: #444; font-size: 14px; margin-bottom: 6px; }
.req-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: #888; }
.req-meta .phone-link { color: #16a085; font-weight: 600; text-decoration: none; }

.status-badge {
    display: inline-block;
    padding: 3px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 700; color: #fff;
    text-transform: uppercase; letter-spacing: .3px;
}
.status-badge.s-new       { background: #3498db; }
.status-badge.s-in_work   { background: #e67e22; }
.status-badge.s-done      { background: #27ae60; }
.status-badge.s-cancelled { background: #999; }

.card {
    background: #fff; border-radius: 12px;
    padding: 14px 16px; margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card-title {
    font-size: 14px; font-weight: 700; color: #16a085;
    margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: .5px;
}
.card-row { display: flex; padding: 8px 0; border-bottom: 1px solid #f0f2f4; gap: 10px; }
.card-row:last-child { border-bottom: none; }
.label { width: 130px; flex-shrink: 0; color: #888; font-size: 13px; }
.value { flex: 1; color: #222; font-size: 15px; word-break: break-word; }
.phone-link { color: #16a085; font-weight: 700; text-decoration: none; font-size: 16px; }

.actions { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }

.total-row { text-align: right; color: #555; font-size: 14px; margin-top: 4px; }
.total-row strong { color: #16a085; font-size: 18px; }


/* ───────── Этап 3: Оффлайн-индикаторы ───────── */

.status-bar {
    background: #f39c12;
    color: #fff;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    box-shadow: 0 1px 0 rgba(0,0,0,.1);
}
.status-bar.offline { background: #c0392b; }
.status-bar.syncing { background: #16a085; }

.req-card.pending-sync {
    border-left-color: #f39c12 !important;
    position: relative;
}
.req-card.pending-sync::after {
    content: "🕓";
    position: absolute;
    top: 10px; right: 10px;
    font-size: 16px;
    opacity: .8;
}

.pending-banner {
    background: #fff3e0;
    color: #b9770e;
    border: 1px solid #f5c97a;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
}
