

/* ═══════════════════════════════════════════════════════════════════
   WARRANTY REPLACEMENT — REDESIGNED UI (v2)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Toast ─────────────────────────────────────────────────────────── */
.wr-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    cursor: pointer;
    animation: wr-toast-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
    max-width: 380px;
}
@keyframes wr-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.wr-toast--success { background: #10b981; color: #fff; }
.wr-toast--error   { background: #ef4444; color: #fff; }
.wr-toast__icon    { font-size: 16px; font-weight: 800; }
.wr-toast__msg     { flex: 1; }
.wr-toast__close   { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 18px; cursor: pointer; line-height: 1; padding: 0; }

/* ── Side Drawer ────────────────────────────────────────────────────── */
.wr-drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
    display: flex; justify-content: flex-end;
    animation: wr-fade-in 0.2s ease;
}
@keyframes wr-fade-in { from { opacity: 0; } to { opacity: 1; } }

.wr-drawer {
    width: min(540px, 92vw);
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    box-shadow: -16px 0 48px rgba(0,0,0,0.3);
    animation: wr-drawer-in 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes wr-drawer-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.wr-drawer__header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.wr-drawer__eyebrow {
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 4px;
}
.wr-drawer__title {
    font-size: 17px; font-weight: 700; color: var(--text-primary);
}
.wr-drawer__subtitle {
    font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 6px;
}
.wr-drawer__close {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all var(--transition); flex-shrink: 0;
}
.wr-drawer__close:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.3); }
.wr-drawer__body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* History stats row */
.wr-history-stats {
    display: flex; gap: 12px; margin-bottom: 20px;
}
.wr-stat-pill {
    flex: 1; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 16px;
    display: flex; flex-direction: column; gap: 2px;
}
.wr-stat-pill__num  { font-size: 16px; font-weight: 700; color: var(--accent); }
.wr-stat-pill__label { font-size: 11px; color: var(--text-muted); }

/* History card */
.wr-history-card {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    margin-bottom: 12px; transition: border-color var(--transition);
}
.wr-history-card:hover { border-color: var(--accent); }
.wr-history-card__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; flex-wrap: wrap; gap: 8px;
}
.wr-history-card__date {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted); font-weight: 600;
}
.wr-reason-chip {
    display: inline-flex; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    background: rgba(239,68,68,0.1); color: #ef4444;
    border: 1px solid rgba(239,68,68,0.25);
}
.wr-history-card__body {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap; margin-bottom: 10px;
}
.wr-history-item {
    flex: 1; min-width: 100px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.wr-history-item--new {
    border-color: rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.04);
}
.wr-history-item__label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 4px;
}
.wr-history-item__serial {
    font-family: var(--font-mono, monospace); font-size: 12px;
    font-weight: 700; color: var(--accent); margin-bottom: 2px;
}
.wr-history-item__type { font-size: 11px; color: var(--text-muted); }
.wr-history-card__arrow { font-size: 18px; color: var(--text-muted); flex-shrink: 0; }

.wr-history-warranty-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid;
}
.wr-history-warranty-badge--valid {
    background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.25); color: #10b981;
}
.wr-history-warranty-badge--expired {
    background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); color: #ef4444;
}
.wr-history-warranty-badge__icon { font-size: 18px; }
.wr-history-warranty-badge__val  { font-size: 13px; font-weight: 700; }
.wr-history-warranty-badge__sub  { font-size: 10px; opacity: 0.7; }

.wr-history-card__remark {
    display: flex; align-items: flex-start; gap: 6px;
    font-size: 12px; color: var(--text-muted); font-style: italic;
    padding: 8px 10px; background: var(--surface); border-radius: var(--radius-sm);
    border-left: 2px solid var(--border); margin-bottom: 8px;
}
.wr-history-card__footer {
    font-size: 11px; color: var(--text-muted); text-align: right;
}

/* ── Empty state ────────────────────────────────────────────────────── */
.wr-empty-state {
    text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.wr-empty-state__icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }

/* ── Page Header ────────────────────────────────────────────────────── */
.wr-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.wr-page-header__left {
    display: flex; align-items: center; gap: 16px;
}
.wr-page-header__icon { font-size: 32px; line-height: 1; }
.wr-page-header__eyebrow {
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 2px;
}
.wr-page-header__title {
    font-size: 22px; font-weight: 800; color: var(--text-primary); margin: 0;
}

/* History button in header */
.wr-history-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 700;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-primary); cursor: pointer;
    transition: all var(--transition); white-space: nowrap;
}
.wr-history-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(124,106,247,0.06); }
.wr-history-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.wr-history-btn__badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; font-size: 10px; font-weight: 800;
    background: var(--accent); color: #fff;
}

/* ── Step cards ─────────────────────────────────────────────────────── */
.wr-step-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px 28px; margin-bottom: 20px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.wr-step-card--active {
    border-color: rgba(124,106,247,0.4);
    box-shadow: 0 0 0 3px rgba(124,106,247,0.07);
}
.wr-step-card--done { border-color: rgba(16,185,129,0.3); }
.wr-step-card__header {
    display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.wr-step-num {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
    background: rgba(124,106,247,0.12); border: 2px solid var(--accent);
    color: var(--accent);
}
.wr-step-num--done {
    background: rgba(16,185,129,0.12); border-color: #10b981; color: #10b981;
}
.wr-step-card__label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px;
}
.wr-step-card__title { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* ── Search bar (enhanced) ──────────────────────────────────────────── */
.wr-search-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 10px 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.wr-search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,106,247,0.12);
}
.wr-search-bar--selected { border-color: rgba(16,185,129,0.5); }
.wr-search-bar .form-input {
    flex: 1; background: transparent; border: none; box-shadow: none;
    font-size: 14px; padding: 2px 0;
}
.wr-search-bar .form-input:focus { outline: none; box-shadow: none; border: none; }
.wr-search-bar__icon  { color: var(--text-muted); display: flex; align-items: center; flex-shrink: 0; }
.wr-search-bar__spinner { display: flex; align-items: center; }
.wr-search-bar__clear {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer;
    transition: all var(--transition);
}
.wr-search-bar__clear:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* Device result row */
.wr-device-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wr-device-result__left { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.wr-device-result__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.wr-device-result__serial { font-family: var(--font-mono, monospace); font-size: 12px; font-weight: 700; color: var(--accent); }
.wr-device-result__name   { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.wr-device-result__grn    { font-size: 11px; color: var(--text-muted); }
.wr-device-result__type   { font-size: 11px; color: var(--text-muted); }

/* ── Warranty status banner ─────────────────────────────────────────── */
.wr-warranty-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 20px;
    border: 1px solid;
}
.wr-warranty-banner--valid {
    background: rgba(16,185,129,0.07); border-color: rgba(16,185,129,0.3);
}
.wr-warranty-banner--expired {
    background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.3);
}
.wr-warranty-banner--grace {
    background: rgba(245,158,11,0.07); border-color: rgba(245,158,11,0.4);
}
.wr-pending-warranty--grace {
    background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.3);
}
.wr-warranty-banner__left { display: flex; align-items: center; gap: 14px; }
.wr-warranty-banner__icon { font-size: 24px; line-height: 1; }
.wr-warranty-banner__status {
    font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px;
}
.wr-warranty-banner__date { font-size: 12px; color: var(--text-muted); }
.wr-warranty-banner__countdown { text-align: right; }
.wr-warranty-banner__count-num {
    font-size: 22px; font-weight: 800; color: #10b981; display: flex; align-items: baseline; gap: 6px;
}
.wr-warranty-banner__count-num span { display: flex; align-items: baseline; gap: 3px; }
.wr-warranty-banner__count-num small { font-size: 11px; font-weight: 600; opacity: 0.75; }
.wr-warranty-banner__count-label { font-size: 11px; color: var(--text-muted); text-align: right; }

/* ── Info grid ──────────────────────────────────────────────────────── */
.wr-info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden;
    margin-bottom: 20px;
}
.wr-info-cell {
    background: var(--surface); padding: 12px 16px;
}
.wr-info-cell__label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 4px;
}
.wr-info-cell__val { font-size: 13.5px; color: var(--text-primary); font-weight: 500; }
.wr-info-cell__val--mono {
    font-family: var(--font-mono, monospace); font-size: 12px; color: var(--accent); font-weight: 700;
}

/* ── Sub-item chip selector ─────────────────────────────────────────── */
.wr-subitem-section { margin-top: 4px; }
.wr-subitem-section__label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 10px;
}
.wr-chip-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.wr-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 24px; font-size: 12px; font-weight: 600;
    background: var(--surface-2); border: 1.5px solid var(--border);
    color: var(--text-primary); cursor: pointer;
    transition: all var(--transition); user-select: none;
}
.wr-chip:hover { border-color: var(--accent); color: var(--accent); }
.wr-chip--active {
    background: rgba(124,106,247,0.12); border-color: var(--accent); color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,106,247,0.1);
}
.wr-chip__serial {
    font-family: var(--font-mono, monospace); font-size: 10px;
    opacity: 0.65; padding-left: 4px; border-left: 1px solid currentColor; margin-left: 2px;
}

/* ── Two-column form layout ─────────────────────────────────────────── */
.wr-form-layout {
    display: grid; grid-template-columns: 300px 1fr;
    gap: 24px; align-items: start;
}
@media (max-width: 900px) { .wr-form-layout { grid-template-columns: 1fr; } }

/* ── Faulty item panel (left) ───────────────────────────────────────── */
.wr-faulty-panel {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; position: sticky; top: 20px;
}
.wr-panel-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px;
}
.wr-faulty-serial {
    font-family: var(--font-mono, monospace); font-size: 15px; font-weight: 800;
    color: var(--accent); margin-bottom: 4px;
}
.wr-faulty-type {
    font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.wr-faulty-fields { display: flex; flex-direction: column; gap: 0; }
.wr-faulty-field {
    display: flex; align-items: baseline; gap: 8px;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.wr-faulty-field:last-child { border-bottom: none; }
.wr-faulty-field__label { width: 110px; flex-shrink: 0; color: var(--text-muted); font-weight: 600; font-size: 12px; }
.wr-faulty-field__val   { flex: 1; color: var(--text-primary); }

/* Pending warranty widget */
.wr-pending-warranty {
    margin-top: 16px; padding: 14px 16px;
    border-radius: var(--radius-sm); border: 1px solid;
}
.wr-pending-warranty--valid {
    background: rgba(124,106,247,0.07); border-color: rgba(124,106,247,0.25);
}
.wr-pending-warranty--expired {
    background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.25);
}
.wr-pending-warranty__label {
    display: flex; align-items: center; gap: 5px;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 8px;
}
.wr-pending-warranty__value { }
.wr-pending-expired { font-size: 12px; color: #ef4444; font-weight: 600; }
.wr-pending-time {
    display: flex; align-items: baseline; gap: 6px;
}
.wr-pending-time strong { font-size: 20px; font-weight: 800; color: var(--accent); }
.wr-pending-time small  { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.wr-pending-remaining   { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

/* ── Right form fields ──────────────────────────────────────────────── */
.wr-fields-panel { display: flex; flex-direction: column; gap: 16px; }
.wr-field-group  { display: flex; flex-direction: column; gap: 6px; }
.wr-field-label  {
    font-size: 12px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px;
}
.wr-field-hint { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-muted); opacity: 0.75; }
.wr-field-note {
    display: flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* Section divider inside form */
.wr-section-divider {
    display: flex; align-items: center; gap: 12px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted); margin: 4px 0;
}
.wr-section-divider::before,
.wr-section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* OR divider */
.wr-or-divider {
    text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted);
    position: relative;
}
.wr-or-divider::before,
.wr-or-divider::after {
    content: ''; position: absolute; top: 50%; width: 40%;
    height: 1px; background: var(--border);
}
.wr-or-divider::before { left: 0; }
.wr-or-divider::after  { right: 0; }

/* Read-only field */
.wr-readonly-field {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted);
    font-style: italic;
}

/* Inventory linked badge */
.wr-inv-linked-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.3);
    color: #10b981; font-size: 12px; font-weight: 600; margin-top: 6px;
}
.wr-inv-unlink {
    margin-left: auto; background: none; border: none;
    color: inherit; font-size: 16px; cursor: pointer; line-height: 1;
    opacity: 0.7; padding: 0;
}
.wr-inv-unlink:hover { opacity: 1; }

/* Textarea */
.wr-textarea { resize: vertical; min-height: 80px; }

/* ── Action bar ─────────────────────────────────────────────────────── */
.wr-action-bar {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}
.wr-btn-clear {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 700;
}
.wr-btn-save {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 24px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 700;
}

/* ── Placeholder ────────────────────────────────────────────────────── */
.wr-placeholder {
    text-align: center; padding: 80px 24px; color: var(--text-muted);
}
.wr-placeholder__icon  { font-size: 52px; margin-bottom: 16px; opacity: 0.3; }
.wr-placeholder__title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.wr-placeholder__sub   { font-size: 14px; color: var(--text-muted); max-width: 420px; margin: 0 auto; line-height: 1.6; }

/* ── Warranty form card select fix (inherited) ──────────────────────── */
.wr-step-card .form-select {
    width: 100%; min-height: 38px; padding: 8px 34px 8px 12px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
    font-family: inherit; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition);
}
.wr-step-card .form-select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,106,247,0.15);
}
.wr-step-card .form-select.input-error { border-color: var(--danger); }
.wr-step-card input[type="datetime-local"].form-input { color-scheme: dark; }


/* ── Blocked chip (no warranty / expired beyond grace) ──────────────── */
.wr-chip--blocked {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    opacity: 0.75;
    cursor: pointer;
}
.wr-chip--blocked:hover { opacity: 1; border-color: #ef4444 !important; color: #ef4444 !important; }
.wr-chip--blocked.wr-chip--active { background: rgba(239,68,68,0.12); }
.wr-chip__no-warranty {
    font-size: 10px; margin-left: 4px; color: #ef4444;
}

/* ── Warranty block notice (shown instead of replacement form) ───────── */
.wr-block-notice {
    display: flex; align-items: flex-start; gap: 14px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-top: 8px;
}
.wr-block-notice__icon { font-size: 24px; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.wr-block-notice__title {
    font-size: 14px; font-weight: 700; color: #ef4444; margin-bottom: 4px;
}
.wr-block-notice__msg {
    font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}
