/* RND Automation Hub — minimal dashboard CSS. Dark workshop theme. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #e6e6e6; background: #0f1419; }

.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at top, #1a2533 0%, #0f1419 60%); }
.login-card { width: 360px; max-width: 90vw; background: #19222d; padding: 32px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
.login-card header { text-align: center; margin-bottom: 24px; }
.login-card h1 { margin: 0; font-size: 26px; letter-spacing: 0.5px; color: #ff8c42; }
.login-card .subtitle { margin: 4px 0 0; color: #8a9aab; font-size: 14px; }
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 4px; font-size: 13px; color: #b3c0cd; }
.login-card input { padding: 10px 12px; border-radius: 8px; border: 1px solid #2a3744; background: #0f1419; color: #e6e6e6; font-size: 14px; }
.login-card input:focus { outline: 2px solid #ff8c42; outline-offset: -1px; }
.login-card button { margin-top: 6px; padding: 11px; border-radius: 8px; border: 0; background: #ff8c42; color: #1a1208; font-weight: 700; cursor: pointer; font-size: 14px; }
.login-card button:hover { background: #ffa066; }
.login-card .error { color: #ff6b6b; font-size: 13px; margin: 0; }
.login-card footer { margin-top: 18px; text-align: center; color: #6a7585; }

.app-body { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #14202c; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; border-right: 1px solid #1f2c3a; }
.sidebar .brand { display: flex; align-items: baseline; gap: 6px; }
.sidebar .brand strong { color: #ff8c42; font-size: 22px; letter-spacing: 1px; }
.sidebar .brand span { color: #8a9aab; font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: block; padding: 9px 12px; border-radius: 7px; color: #b3c0cd; text-decoration: none; font-size: 14px; }
.sidebar nav a:hover { background: #1c2a38; color: #e6e6e6; }
.sidebar nav a.active { background: #2a3744; color: #ff8c42; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: #6a7585; display: flex; flex-direction: column; gap: 8px; }
.link-btn { background: none; border: 0; color: #ff8c42; cursor: pointer; padding: 0; text-align: left; font-size: 13px; }

.content { padding: 28px 32px; overflow-y: auto; }
.tab { display: none; }
.tab.active { display: block; }
.tab > header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.tab > header h2 { margin: 0; font-size: 24px; color: #e6e6e6; }
.tab .actions { display: flex; gap: 8px; align-items: center; }
.tab .actions input, .tab .actions select { padding: 7px 10px; border-radius: 6px; border: 1px solid #2a3744; background: #0f1419; color: #e6e6e6; font-size: 13px; }
.tab .actions button.primary { padding: 8px 14px; border-radius: 6px; border: 0; background: #ff8c42; color: #1a1208; font-weight: 600; cursor: pointer; font-size: 13px; }
.tab .actions button.primary:hover { background: #ffa066; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 28px; }
.cards .card { background: #19222d; padding: 16px; border-radius: 10px; border: 1px solid #1f2c3a; }
.cards .card .label { color: #8a9aab; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.cards .card .value { color: #e6e6e6; font-size: 24px; margin-top: 6px; font-weight: 600; }
.cards .card .delta { color: #6a7585; font-size: 12px; margin-top: 4px; }

.data-table { width: 100%; border-collapse: collapse; background: #14202c; border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid #1f2c3a; text-align: left; font-size: 13px; }
.data-table th { background: #1c2a38; color: #8a9aab; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; }
.data-table tbody tr:hover { background: #1a2533; cursor: pointer; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr.low-stock { color: #ff6b6b; }
.data-table tr.inactive-row { opacity: 0.55; font-style: italic; }
button.danger { color: #ff6b6b; border-color: #4a2828; background: #1a1414; }
button.danger:hover { background: #2a1818; }

.inline-stats { color: #8a9aab; font-size: 13px; }
.muted { color: #8a9aab; }
.card { background: #19222d; padding: 16px; border-radius: 10px; border: 1px solid #1f2c3a; margin-bottom: 16px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-grid .tile { background: #19222d; border-radius: 8px; overflow: hidden; border: 1px solid #1f2c3a; }
.photo-grid .tile img { width: 100%; height: 160px; object-fit: cover; display: block; cursor: pointer; }
.photo-grid .tile .file-placeholder { height: 160px; display: grid; place-items: center; color: #6a7585; font-size: 14px; }
.doc-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 8px; }

.wa-label { color: #ff8c42; }

.personal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.personal-col { background: #14202c; border: 1px solid #1f2c3a; border-radius: 10px; padding: 16px; min-height: 60vh; }
.personal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.personal-head h3 { margin: 0; }
.personal-col input[type="search"] { margin-bottom: 12px; padding: 7px 10px; border-radius: 6px; border: 1px solid #2a3744; background: #0f1419; color: #e6e6e6; font-size: 13px; width: 100%; box-sizing: border-box; }

.todo-list, .note-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-item, .note-item { background: #0f1419; border: 1px solid #1f2c3a; border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.todo-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: #ff8c42; cursor: pointer; }
.todo-item .title { font-weight: 600; color: #e6e6e6; }
.todo-item .meta, .note-item .meta { color: #8a9aab; font-size: 12px; margin-top: 2px; }
.todo-item.done .title { text-decoration: line-through; color: #6a7585; }
.todo-item.overdue .meta { color: #ff6b6b; font-weight: 600; }
.todo-item.urgent { border-left: 3px solid #ff6b6b; }
.todo-item.high { border-left: 3px solid #ff8c42; }
.todo-item .actions, .note-item .actions { display: flex; gap: 4px; }
.todo-item .actions button, .note-item .actions button { background: none; border: 0; color: #6a7585; cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 4px; }
.todo-item .actions button:hover, .note-item .actions button:hover { background: #1c2a38; color: #e6e6e6; }
.note-item.pinned { border-left: 3px solid #ff8c42; }
.note-item .pin-handle { cursor: pointer; user-select: none; font-size: 14px; }
.note-item .title { font-weight: 600; color: #e6e6e6; }
.note-item .body { color: #b3c0cd; font-size: 13px; margin-top: 4px; white-space: pre-wrap; max-height: 6em; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 900px) {
  .personal-grid { grid-template-columns: 1fr; }
}
.wa-qr-block { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; margin: 18px 0; padding: 18px; background: #0f1419; border-radius: 10px; border: 1px solid #1f2c3a; }
.wa-qr-block img { width: 320px; height: 320px; background: #fff; padding: 8px; border-radius: 8px; display: block; }
.wa-qr-help strong { color: #ff8c42; display: block; margin-bottom: 8px; font-size: 15px; }
.wa-qr-help ol { padding-left: 20px; line-height: 1.7; color: #e6e6e6; }
.wa-qr-help ol em { color: #ff8c42; font-style: normal; }
.wa-btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.wa-btn-row button { padding: 8px 14px; border-radius: 6px; border: 1px solid #2a3744; background: #1a2533; color: #b3c0cd; cursor: pointer; font-size: 13px; }
.wa-btn-row button.primary { background: #ff8c42; color: #1a1208; border-color: #ff8c42; font-weight: 600; }
.wa-btn-row button:hover { background: #2a3744; }
.wa-btn-row button.primary:hover { background: #ffa066; }

@media (max-width: 720px) {
  .wa-qr-block { grid-template-columns: 1fr; }
  .wa-qr-block img { width: 100%; max-width: 320px; height: auto; }
}

.dropzone { border: 2px dashed #2a3744; border-radius: 10px; padding: 28px; text-align: center; margin-bottom: 18px; background: #14202c; transition: border-color 0.15s, background 0.15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: #ff8c42; background: #1c2a38; }
.dropzone.over { box-shadow: inset 0 0 0 2px rgba(255,140,66,0.2); }
.dropzone-inner strong { color: #ff8c42; font-size: 16px; }
.dropzone-inner small { color: #8a9aab; font-size: 12px; }
.dropzone-inner { pointer-events: none; }
#dropzoneStatus { margin-top: 10px; font-size: 13px; }

.badge { display: inline-block; background: #ff8c42; color: #1a1208; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; margin-left: 6px; }

.review-list { display: grid; gap: 12px; }
.review-item { background: #14202c; border: 1px solid #1f2c3a; border-radius: 8px; padding: 14px; display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; align-items: center; }
.review-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; }
.review-item .file-placeholder { width: 96px; height: 96px; display: grid; place-items: center; color: #6a7585; background: #0f1419; border-radius: 6px; font-size: 12px; }
.review-item .meta { font-size: 13px; color: #b3c0cd; line-height: 1.5; }
.review-item .meta .doc-type { background: #2a3744; color: #ff8c42; padding: 1px 7px; border-radius: 4px; font-size: 11px; margin-right: 6px; }
.review-item .meta .reason { color: #ffaa66; font-size: 12px; margin-top: 4px; }
.review-item .actions { display: flex; flex-direction: column; gap: 6px; align-items: end; }
.review-item .actions button { padding: 5px 10px; border-radius: 5px; border: 1px solid #2a3744; background: #1a2533; color: #b3c0cd; cursor: pointer; font-size: 12px; min-width: 100px; }
.review-item .actions button.primary { background: #ff8c42; color: #1a1208; border-color: #ff8c42; }
.review-item .actions button.danger { color: #ff6b6b; border-color: #4a2828; }
.review-item .actions button:hover { background: #2a3744; }
.review-item .actions button.primary:hover { background: #ffa066; }
.photo-grid .tile .meta { padding: 8px 10px; font-size: 12px; color: #8a9aab; }
.photo-grid .tile .meta .doc-type { display: inline-block; padding: 2px 7px; border-radius: 4px; background: #2a3744; color: #ff8c42; margin-right: 6px; font-size: 11px; }

.filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 20px; border: 1px solid #2a3744; background: transparent; color: #8a9aab; font-size: 12px; cursor: pointer; }
.chip.active { background: #ff8c42; color: #1a1208; border-color: #ff8c42; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col article { background: #14202c; padding: 16px; border-radius: 8px; }
.md-pre { background: #0f1419; padding: 14px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; color: #b3c0cd; max-height: 480px; overflow-y: auto; }

form { display: grid; gap: 12px; max-width: 480px; }
form label { display: grid; gap: 4px; font-size: 13px; color: #b3c0cd; }
form input, form select, form textarea { padding: 8px 10px; border-radius: 6px; border: 1px solid #2a3744; background: #0f1419; color: #e6e6e6; font-family: inherit; font-size: 13px; }
form button { padding: 9px 14px; border-radius: 6px; border: 0; background: #ff8c42; color: #1a1208; font-weight: 600; cursor: pointer; font-size: 13px; justify-self: start; }
form button:hover { background: #ffa066; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: grid; place-items: center; z-index: 999; }
/* CSS `display: grid` above overrides the HTML `hidden` attribute (which
   defaults to display:none). Without this override the modal blanket-
   intercepts clicks across the whole viewport — found via Playwright UI test. */
.modal-backdrop[hidden] { display: none; }
.modal { width: 520px; max-width: 92vw; max-height: 85vh; overflow-y: auto; background: #19222d; border-radius: 10px; border: 1px solid #2a3744; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #1f2c3a; }
.modal header h3 { margin: 0; font-size: 18px; }
.modal #modalBody { padding: 18px; }

.file-btn { display: inline-block; padding: 7px 14px; background: #2a3744; color: #ff8c42; border-radius: 6px; cursor: pointer; font-size: 13px; }
.file-btn:hover { background: #364554; }

@media (max-width: 768px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .two-col { grid-template-columns: 1fr; }
}
