/* ============================================================
   Sistem Gudang fypworks — style.css
   Meniru tampilan Tailwind versi Next.js (self-contained).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, "Noto Sans", sans-serif;
    background: #f9fafb;
    color: #1f2937;
    line-height: 1.5;
    font-size: 14px;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* ---------------- Layout ---------------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }
@media (min-width: 768px) { .wrap { padding: 32px; } }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #111827; font-size: 15px; }
.brand img { border-radius: 6px; }
.logout-form { margin: 0; }

.banner {
    width: 100%; height: 128px; margin-bottom: 16px;
    border-radius: 16px; overflow: hidden;
    border: 1px solid #e5e7eb; background: #111827;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (min-width: 768px) { .banner { height: 256px; } }
.banner img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.banner-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }

.page-head {
    display: flex; flex-direction: column; gap: 16px;
    margin-bottom: 24px;
}
@media (min-width: 768px) {
    .page-head { flex-direction: row; justify-content: space-between; align-items: center; }
}
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: #111827; margin: 0; }
.page-head p { margin: 4px 0 0; }

.grid { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: start; }
@media (min-width: 1024px) { .grid { grid-template-columns: 1fr 2fr; } }
.col-left, .col-right { display: flex; flex-direction: column; gap: 24px; }
/* Dipakai saat kolom kiri tidak dirender sama sekali (mis. peran viewer) */
@media (min-width: 1024px) { .grid.grid-single { grid-template-columns: 1fr; } }

/* ---------------- Card ---------------- */
.card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.card-title { font-size: 18px; font-weight: 700; color: #111827; margin: 0 0 16px; }
.card-title.sm { font-size: 16px; margin-bottom: 12px; }
.hint-blue { color: #2563eb; font-size: 13px; margin-left: 8px; font-weight: 500; }

/* ---------------- Boxes / labels ---------------- */
.box-blue {
    margin-bottom: 24px; padding: 16px;
    background: rgba(239,246,255,.6); border: 1px solid #dbeafe; border-radius: 8px;
}
.box-gray {
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px;
}
.mini-label {
    display: block; font-size: 11px; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .05em; margin: 0 0 8px;
}
.mini-label-blue { color: #1e40af; }

/* ---------------- Forms ---------------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row-3 .col-1 { grid-column: span 1; }
.row-3 .col-2 { grid-column: span 2; }

.input {
    width: 100%; padding: 9px 10px; font-size: 14px;
    border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #1f2937;
    outline: none; transition: box-shadow .15s, border-color .15s;
    font-family: inherit;
}
.input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.35); }
.input.soft { background: #f9fafb; }
.input.bold { font-weight: 600; }
.input.center { text-align: center; }
select.input { appearance: none; -webkit-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='%236b7280' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 18px; font-size: 14px; font-weight: 600;
    border-radius: 8px; border: 1px solid transparent; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    font-family: inherit; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 13px 18px; }
.btn-block { width: 100%; }
.btn-blue { background: #2563eb; color: #fff; }
.btn-blue:hover { background: #1d4ed8; }
.btn-dark { background: #111827; color: #fff; }
.btn-dark:hover { background: #1f2937; }
.btn-light { background: #f3f4f6; color: #1f2937; border-color: #e5e7eb; }
.btn-light:hover { background: #e5e7eb; }
.btn-ghost { background: #fff; color: #4b5563; border-color: #e5e7eb; }
.btn-ghost:hover { background: #f3f4f6; }
.btn-reset { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn-reset:hover { background: #fecaca; }
.btn-dashed {
    width: 100%; padding: 11px; background: #fff; color: #6b7280;
    border: 2px dashed #d1d5db; border-radius: 8px; cursor: pointer;
    font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    transition: border-color .15s, color .15s; font-family: inherit; margin-top: 4px;
}
.btn-dashed:hover { border-color: #60a5fa; color: #2563eb; }
.btn-del {
    flex-shrink: 0; padding: 8px 11px; background: #fef2f2; color: #ef4444;
    border: 1px solid #fee2e2; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn-del:hover { background: #fee2e2; }

/* ---------------- Alerts ---------------- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warn { background: #fefce8; color: #a16207; border: 1px solid #fef08a; }

/* ---------------- Table ---------------- */
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl thead th {
    text-align: left; padding-bottom: 12px; color: #6b7280; font-weight: 500;
    border-bottom: 1px solid #e5e7eb; white-space: nowrap;
}
.tbl tbody tr { border-bottom: 1px solid #f3f4f6; }
.tbl tbody tr:hover { background: rgba(249,250,251,.6); }
.tbl td { padding: 10px 8px 10px 0; }
.tbl td:first-child, .tbl th:first-child { padding-left: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.bold { font-weight: 600; color: #111827; }
.gray { color: #4b5563; }
.name { color: #111827; font-weight: 500; }
.sort-btn {
    display: inline-block; margin-left: 8px; padding: 2px 8px;
    background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 4px;
    font-size: 11px; font-weight: 700; color: #4b5563;
}
.sort-btn:hover { background: #e5e7eb; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex; align-items: center; padding: 2px 10px;
    border-radius: 9999px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-green { background: #dcfce7; color: #166534; }

/* ---------------- Pagination ---------------- */
.pager {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid #f3f4f6;
}
.muted { color: #6b7280; font-size: 14px; font-weight: 500; }
.pager-btns { display: flex; gap: 8px; }
.pg {
    padding: 6px 12px; font-size: 14px; font-weight: 700; border-radius: 6px;
    border: 1px solid #d1d5db; background: #fff; color: #1f2937; transition: background .15s;
}
.pg:hover { background: #f3f4f6; }
.pg.disabled { background: #f9fafb; color: #9ca3af; border-color: #f3f4f6; pointer-events: none; }

/* ---------------- Transaction log ---------------- */
.tx-head {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #f3f4f6;
}
@media (min-width: 640px) { .tx-head { flex-direction: row; justify-content: space-between; align-items: center; } }
.log-title { font-family: ui-monospace, monospace; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 700; margin: 0; }
.search-form { display: flex; gap: 8px; width: 100%; }
@media (min-width: 640px) { .search-form { width: auto; } }
.input.search { flex: 1; background: #f9fafb; }

.tx-list { display: flex; flex-direction: column; gap: 10px; }
.tx-item {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 12px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 12px; transition: background .15s;
}
.tx-item:hover { background: #fff; }
.tx-info { padding-right: 16px; }
.tx-name { display: block; font-weight: 700; color: #1f2937; margin-bottom: 2px; }
.tx-notes { color: #6b7280; }
.tx-right { text-align: right; white-space: nowrap; }
.tx-tag { font-weight: 700; padding: 2px 8px; border-radius: 4px; border: 1px solid; font-size: 12px; }
.tx-green  { color: #16a34a; background: #f0fdf4; border-color: #dcfce7; }
.tx-red    { color: #dc2626; background: #fef2f2; border-color: #fee2e2; }
.tx-orange { color: #ea580c; background: #fff7ed; border-color: #fed7aa; }
.tx-blue   { color: #2563eb; background: #eff6ff; border-color: #dbeafe; }
.tx-purple { color: #9333ea; background: #faf5ff; border-color: #e9d5ff; }
.tx-gray   { color: #4b5563; background: #f3f4f6; border-color: #e5e7eb; }
.tx-time { display: block; margin-top: 6px; font-size: 10px; color: #9ca3af; font-weight: 500; }
.empty { font-size: 14px; color: #6b7280; font-style: italic; text-align: center; padding: 16px 0; }

/* ---------------- Rakitan: dynamic rows ---------------- */
.part-input-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.grow { flex: 1; min-width: 0; }
.qtybox { width: 64px; flex-shrink: 0; }

/* ---------------- Rakitan: build cards ---------------- */
.build-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 768px) { .build-grid { grid-template-columns: 1fr 1fr; } }
.build-card:hover { box-shadow: 0 4px 6px rgba(0,0,0,.07); }
.asset-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.build-name { font-size: 16px; font-weight: 700; color: #111827; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid #f3f4f6; }
.part-row { display: flex; justify-content: space-between; align-items: flex-start; font-size: 14px; }
.part-name { font-weight: 500; color: #1f2937; }
.part-qty { font-weight: 700; color: #dc2626; background: #fef2f2; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.sm-text { font-size: 12px; }
.sm-text.gray, .part-row .mono { display: block; color: #6b7280; margin-bottom: 2px; }

.empty-box {
    padding: 48px; background: #fff; border: 2px dashed #e5e7eb; border-radius: 12px;
    text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.empty-box h3 { font-size: 18px; font-weight: 700; color: #1f2937; margin: 0; }
.empty-box p { margin: 4px 0 0; }

/* ---------------- Footer ---------------- */
.foot { text-align: center; color: #9ca3af; font-size: 12px; margin-top: 40px; padding: 16px 0; }

/* ---------------- Card header w/ actions (search + export) ---------------- */
.card-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Tombol export Excel */
.btn-excel { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.btn-excel:hover { background: #bbf7d0; }

/* Tombol hapus (danger) */
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ---------------- Kolom Aksi di tabel ---------------- */
.actions { white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
.act-btn {
    display: inline-block; padding: 4px 10px; margin-left: 4px;
    font-size: 12px; font-weight: 700; border-radius: 6px; border: 1px solid;
    cursor: pointer; font-family: inherit; text-decoration: none; line-height: 1.4;
}
.act-edit { background: #eff6ff; color: #2563eb; border-color: #dbeafe; }
.act-edit:hover { background: #dbeafe; }
.act-del { background: #fef2f2; color: #dc2626; border-color: #fee2e2; }
.act-del:hover { background: #fee2e2; }
.act-history { background: #f5f3ff; color: #7c3aed; border-color: #e9d5ff; }
.act-history:hover { background: #ede9fe; }

/* ---------------- Ringkasan (stat tiles) ---------------- */
.stats { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat {
    background: #fff; border: 1px solid #e5e7eb; border-left-width: 4px; border-radius: 12px;
    padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.stat-value { font-size: 28px; font-weight: 800; color: #111827; line-height: 1.1; }
.stat-sub { font-size: 12px; color: #9ca3af; }
.stat-green { border-left-color: #16a34a; } .stat-green .stat-value { color: #166534; }
.stat-red   { border-left-color: #dc2626; } .stat-red .stat-value   { color: #b91c1c; }
.stat-dark  { border-left-color: #111827; }

/* nilai +/- dan sel tak-wrap */
.nowrap { white-space: nowrap; }
.pos { color: #16a34a; }
.neg { color: #dc2626; }

/* ---------------- Filter dropdown sparepart ---------------- */
.select-filter { margin-bottom: 6px; background: #fff; }

/* ---------------- Halaman edit ---------------- */
.edit-layout { display: grid; grid-template-columns: 1fr; gap: 24px; max-width: 920px; }
@media (min-width: 768px) { .edit-layout { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.danger-card { border-color: #fecaca; }
.note-sm { font-size: 12px; color: #6b7280; margin: 4px 0 0; line-height: 1.5; }

/* ---------------- Login ---------------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 16px;
    padding: 36px 32px; width: 100%; max-width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,.06); text-align: center;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-logo img { border-radius: 10px; }
.login-card h1 { font-size: 20px; font-weight: 700; color: #111827; margin: 0; }
.login-sub { color: #6b7280; font-size: 14px; margin: 6px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-form label { font-size: 12px; font-weight: 600; color: #374151; margin-top: 8px; }
.login-form input { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid #d1d5db; border-radius: 8px; outline: none; font-family: inherit; }
.login-form input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.35); }
.login-form .btn { margin-top: 16px; }
