/* Flipkart Operations Console
   ---------------------------
   A tool that creates live job postings. The interface is deliberately quiet so
   that the two loud things — a validation failure and a created record — are the
   only things that draw the eye. No card grid, no decoration, hairline rules.

   Monospace appears only on identifiers, payloads and CSV headers, where you
   read character by character. */

:root {
  --surface:    #f7f7f5;
  --panel:      #ffffff;
  --sidebar:    #1c1e22;
  --sidebar-fg: #a9adb4;
  --ink:        #16181c;
  --muted:      #6b7076;
  --rule:       #dfe1e0;
  --rule-soft:  #eeefed;

  --alert:      #a6231b;
  --alert-bg:   #fbeceb;
  --ok:         #1f5d45;
  --ok-bg:      #ecf4f0;
  --pending:    #7a5b12;
  --pending-bg: #faf3e2;
  --action:     #1b3a6b;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* --- Shell -------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--sidebar);
  color: var(--sidebar-fg);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.brand { padding: 0 20px 22px; }
.brand strong { display: block; color: #fff; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand span { font-size: 12px; color: #71767e; }

.sidebar nav { display: flex; flex-direction: column; }

.sidebar nav a {
  color: var(--sidebar-fg);
  text-decoration: none;
  padding: 9px 20px;
  font-size: 13.5px;
  border-left: 2px solid transparent;
}
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,0.04); }
.sidebar nav a[aria-current="page"] { color: #fff; border-left-color: #fff; background: rgba(255,255,255,0.06); }
.sidebar nav a.soon { color: #55595f; cursor: default; }
.sidebar nav a.soon:hover { background: none; color: #55595f; }
.sidebar nav a.soon::after { content: 'later'; float: right; font-size: 11px; color: #45484d; }

.sidebar footer { margin-top: auto; padding: 16px 20px 0; }
.sidebar footer button {
  background: none; border: 1px solid #35383d; color: var(--sidebar-fg);
  padding: 5px 10px; font-size: 12.5px; border-radius: 3px; cursor: pointer;
}
.sidebar footer button:hover { color: #fff; border-color: #55595f; }

.content { flex: 1; min-width: 0; padding: 30px 34px 90px; max-width: 1160px; }

.page-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 30px; max-width: 66ch; }

/* --- Sections ----------------------------------------------------------- */

.panel { background: var(--panel); border: 1px solid var(--rule); }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.panel-head h2 { font-size: 15px; font-weight: 600; margin: 0 0 2px; letter-spacing: -0.01em; }
.panel-head p { color: var(--muted); margin: 0; font-size: 13px; max-width: 68ch; }
.panel-body { padding: 20px; }

.step { border-top: 1px solid var(--rule); padding: 20px; }
.step:first-child { border-top: none; }
.step h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 3px; }
.step h3 .n {
  display: inline-block; width: 19px; height: 19px; line-height: 19px; text-align: center;
  background: var(--ink); color: #fff; border-radius: 50%; font-size: 11.5px; margin-right: 8px;
  vertical-align: 1px;
}
.step > p { color: var(--muted); margin: 0 0 14px 27px; font-size: 13px; max-width: 66ch; }
.step-inner { margin-left: 27px; }

/* --- Mode toggle -------------------------------------------------------- */

.modes { display: inline-flex; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.modes button {
  border: none; background: var(--panel); padding: 7px 20px; font: inherit; font-size: 13.5px;
  cursor: pointer; color: var(--muted); border-right: 1px solid var(--rule);
}
.modes button:last-child { border-right: none; }
.modes button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* --- Form --------------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px 20px; }

.group-title {
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--rule-soft);
}
.group-title:first-child { margin-top: 0; }

label.field { display: block; }
label.field > .lbl { display: block; font-size: 13px; margin-bottom: 4px; font-weight: 500; }
label.field .req { color: var(--alert); }
label.field .hint { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 4px; }
label.field.wide { grid-column: 1 / -1; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], textarea, select {
  font: inherit; width: 100%; padding: 7px 9px;
  border: 1px solid var(--rule); border-radius: 3px; background: var(--panel); color: var(--ink);
}
input.bad, textarea.bad, select.bad { border-color: var(--alert); background: var(--alert-bg); }
.err { color: var(--alert); font-size: 12.5px; margin-top: 4px; }

textarea { font-family: var(--sans); resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
select { width: auto; min-width: 160px; }

button, .btn {
  font: inherit; font-size: 13.5px; padding: 7px 15px;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  border-radius: 3px; cursor: pointer;
}
button:hover:not([disabled]) { border-color: var(--muted); }
button[disabled] { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--action); border-color: var(--action); color: #fff; }
button.primary:hover:not([disabled]) { background: #142c52; }
button.small { padding: 3px 9px; font-size: 12.5px; }
button.link { border: none; background: none; color: var(--action); padding: 0; text-decoration: underline; }

:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.submit-bar {
  border-top: 1px solid var(--rule); padding: 18px 20px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: #fcfcfb;
}

/* --- Common-field picker ------------------------------------------------ */

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 20px; }
.picker label { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; font-size: 13.5px; }
.picker label.locked { color: var(--muted); }
.picker .k { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* --- Questions ---------------------------------------------------------- */

.q { border: 1px solid var(--rule); padding: 14px; margin-bottom: 10px; background: #fcfcfb; }
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.q-head strong { font-size: 13px; }

/* --- Tables ------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--rule); }
th {
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted);
  padding: 8px 11px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
td { padding: 9px 11px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--alert); }
tr.done td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
td.id, td.num, .mono { font-family: var(--mono); font-size: 12.5px; }
td.num { text-align: right; }
.scroller { max-height: 460px; overflow: auto; border: 1px solid var(--rule); }
.scroller table { border: none; }
.scroller thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

.tag { font-size: 12px; padding: 1px 7px; border: 1px solid; border-radius: 2px; white-space: nowrap; }
.tag.ok, .tag.created { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.tag.bad, .tag.failed { color: var(--alert); border-color: var(--alert); background: var(--alert-bg); }
.tag.wait, .tag.working { color: var(--pending); border-color: var(--pending); background: var(--pending-bg); }

/* --- Messages ----------------------------------------------------------- */

.msg { padding: 11px 15px; border: 1px solid var(--rule); border-left-width: 3px; margin-bottom: 16px; background: var(--panel); }
.msg.error   { border-left-color: var(--alert);   background: var(--alert-bg); }
.msg.warn    { border-left-color: var(--pending); background: var(--pending-bg); }
.msg.success { border-left-color: var(--ok);      background: var(--ok-bg); }
.msg strong { display: block; margin-bottom: 3px; }
ul.issues { margin: 6px 0 0; padding-left: 18px; }
ul.issues li { margin-bottom: 3px; }

details { border: 1px solid var(--rule); background: var(--panel); padding: 9px 13px; margin-top: 10px; }
details summary { cursor: pointer; font-size: 13px; }
details pre {
  font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--surface);
  padding: 12px; overflow-x: auto; margin: 10px 0 0; border: 1px solid var(--rule-soft);
}

/* --- Progress ----------------------------------------------------------- */

.bar { height: 4px; background: var(--rule-soft); overflow: hidden; margin: 12px 0; }
.bar > div { height: 100%; background: var(--action); width: 0; transition: width 0.15s linear; }
@media (prefers-reduced-motion: reduce) { .bar > div { transition: none; } }

.hidden { display: none !important; }

/* --- Login -------------------------------------------------------------- */

.login-wrap { max-width: 330px; margin: 16vh auto; }
.login-wrap h1 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.02em; }
.login-wrap p { color: var(--muted); margin: 0 0 22px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; padding: 14px 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar footer { margin: 10px 0 0; }
  .content { padding: 22px 18px 60px; }
  .step > p, .step-inner { margin-left: 0; }
}
