/* ============================================================
   Family Vault — Windows XP (Luna Blue) Explorer skin
   ============================================================ */

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;padding:12px;
  background:#5a7edc;               /* XP desktop blue */
  background-image:linear-gradient(180deg,#6f97e0 0%,#3f62b5 100%);
  font-family:Tahoma,"Segoe UI",Verdana,Geneva,sans-serif;
  font-size:11px;color:#000;
}

/* ---------- window frame ---------- */
.win{
  max-width:1180px;margin:0 auto;
  background:#ece9d8;
  border:1px solid #0043c8;
  border-radius:8px 8px 0 0;
  box-shadow:0 8px 26px rgba(0,0,0,.45);
  overflow:hidden;
  display:flex;flex-direction:column;
  min-height:min(84vh,760px);
}

.titlebar{
  height:28px;flex:0 0 28px;
  background:linear-gradient(180deg,#0e5fd8 0%,#3b8bf2 8%,#1c68dd 42%,#0a53c9 92%,#0846b0 100%);
  display:flex;align-items:center;gap:6px;padding:0 4px 0 6px;
  color:#fff;font-weight:bold;font-size:11px;
  text-shadow:1px 1px 1px rgba(0,0,0,.5);
  border-bottom:1px solid #0043c8;
}
.titlebar .ico{
  width:16px;height:16px;flex:0 0 16px;
}
.titlebar .t{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.winbtns{display:flex;gap:2px;}
.winbtn{
  width:21px;height:21px;border:1px solid rgba(255,255,255,.65);
  border-radius:3px;color:#fff;font-size:11px;font-weight:bold;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(180deg,#4f92f0,#1a5fc8);
  text-decoration:none;line-height:1;
}
.winbtn.close{background:linear-gradient(180deg,#e8846b,#c1361a);border-color:#f3b3a2;}
.winbtn:hover{filter:brightness(1.15);color:#fff;text-decoration:none;}

/* ---------- menus & toolbars ---------- */
.menubar{
  background:#ece9d8;border-bottom:1px solid #d5d2c2;
  display:flex;gap:2px;padding:2px 4px;
}
.menubar span{padding:2px 7px;border-radius:2px;color:#000;}
.menubar span:hover{background:#316ac5;color:#fff;}

.toolbar{
  background:linear-gradient(180deg,#faf9f5,#ece9d8);
  border-bottom:1px solid #d5d2c2;
  display:flex;align-items:center;gap:2px;padding:3px 5px;flex-wrap:wrap;
}
.tbtn{
  display:flex;align-items:center;gap:5px;
  padding:3px 8px;border:1px solid transparent;border-radius:3px;
  color:#000;text-decoration:none;background:none;cursor:pointer;
  font-family:inherit;font-size:11px;
}
.tbtn:hover{border-color:#b6bdd2;background:#e3ecfb;color:#000;text-decoration:none;}
.tbtn[disabled],.tbtn.off{opacity:.4;pointer-events:none;}
.tbsep{width:1px;height:20px;background:#d5d2c2;margin:0 3px;}

.addrbar{
  background:#ece9d8;border-bottom:1px solid #d5d2c2;
  display:flex;align-items:center;gap:6px;padding:3px 6px;
}
.addrbar label{color:#5a5a5a;}
.addrbox{
  flex:1;background:#fff;border:1px solid #7f9db9;
  padding:2px 5px;display:flex;align-items:center;gap:5px;
  min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
}
.addrbox .p{overflow:hidden;text-overflow:ellipsis;}

/* ---------- body split ---------- */
.body{display:flex;flex:1;min-height:0;}

.sidebar{
  width:186px;flex:0 0 186px;
  background:linear-gradient(180deg,#7ba2e8 0%,#5a83d8 55%,#4a72cf 100%);
  padding:10px 8px;overflow-y:auto;
}
.panel{
  background:#eff4fd;border-radius:4px;margin-bottom:10px;
  overflow:hidden;box-shadow:0 1px 2px rgba(0,0,0,.15);
}
.panel h4{
  margin:0;padding:4px 8px;font-size:11px;color:#1c50a8;
  background:linear-gradient(90deg,#fff 0%,#cfdff7 100%);
  border-bottom:1px solid #dfe8f8;
}
.panel ul{list-style:none;margin:0;padding:6px 8px;}
.panel li{margin:0 0 5px;display:flex;align-items:center;gap:6px;}
.panel a,.panel button{
  color:#0b3c8c;text-decoration:none;background:none;border:none;
  padding:0;font-family:inherit;font-size:11px;cursor:pointer;text-align:left;
}
.panel a:hover,.panel button:hover{color:#e36c09;text-decoration:underline;}
.panel .dim{color:#33528f;font-size:11px;}
.panel form{margin:0;}

.content{
  flex:1;background:#fff;overflow:auto;padding:10px;min-width:0;
}

/* ---------- tiles ---------- */
.tiles{display:flex;flex-wrap:wrap;align-content:flex-start;gap:2px;}
.tile{
  width:210px;display:flex;gap:8px;align-items:flex-start;
  padding:4px;border:1px solid transparent;border-radius:3px;
  text-decoration:none;color:#000;
}
.tile:hover{background:#e8f0fe;border-color:#b7cdf0;color:#000;text-decoration:none;}
.tile .ic{flex:0 0 32px;width:32px;height:32px;}
.tile .nm{font-size:11px;line-height:1.35;word-break:break-word;}
.tile .sub{color:#666;font-size:10px;}

.empty{color:#777;padding:26px 10px;font-style:italic;}

/* ---------- status bar ---------- */
.statusbar{
  flex:0 0 22px;height:22px;
  background:#ece9d8;border-top:1px solid #fff;
  display:flex;align-items:center;gap:0;font-size:11px;color:#333;
}
.statusbar .cell{
  padding:0 8px;height:100%;display:flex;align-items:center;
  border-right:1px solid #c5c2b3;
}
.statusbar .cell:last-child{border-right:none;flex:1;}

/* ---------- dialogs / forms ---------- */
.bar{
  background:#f6f5ee;border:1px solid #d5d2c2;border-radius:3px;
  padding:8px;margin-bottom:10px;
}
.bar h5{margin:0 0 6px;font-size:11px;color:#1c50a8;}
.row-f{display:flex;gap:6px;align-items:center;flex-wrap:wrap;}
input[type=text],input[type=password],input[type=file]{
  border:1px solid #7f9db9;padding:3px 5px;font-family:Tahoma,sans-serif;
  font-size:11px;background:#fff;
}
input[type=text],input[type=password]{min-width:180px;}
.btn{
  font-family:Tahoma,sans-serif;font-size:11px;
  padding:3px 12px;min-width:75px;
  border:1px solid #003c74;border-radius:3px;
  background:linear-gradient(180deg,#fff 0%,#f0f0ea 45%,#dcdcd0 55%,#f5f5ef 100%);
  cursor:pointer;color:#000;
}
.btn:hover{border-color:#e36c09;background:linear-gradient(180deg,#fffdf5,#ffe7bd);}
.btn.danger{color:#8b0000;}

/* compact controls inside the task panel (desktop sizing) */
.btn-sm{min-width:0;padding:2px 7px;}
.nf-form{gap:4px;flex-wrap:nowrap;}
.nf-input{min-width:0;width:98px;}
.file-input{width:100%;margin-bottom:5px;}

.msg{padding:6px 9px;margin-bottom:9px;border-radius:3px;font-size:11px;}
.msg.ok{background:#e8f5e0;border:1px solid #8fbf6f;color:#2b5c14;}
.msg.err{background:#fdeaea;border:1px solid #dba0a0;color:#8b1a1a;}

/* ---------- login ---------- */
.login-wrap{
  max-width:400px;margin:8vh auto 0;
}
.login-wrap .content{padding:18px;}
.login-wrap .win{min-height:0;}
.login-field{margin-bottom:9px;}
.login-field label{display:block;margin-bottom:3px;color:#1c50a8;}
.login-field input{width:100%;}
.hint{color:#666;font-size:10px;margin-top:12px;line-height:1.5;}

/* ============================================================
   PHONE LAYOUT
   The vault is used mostly from a phone, so below 760px this
   stops pretending to be a desktop window: bigger type, real
   touch targets, and the upload control first instead of last.
   ============================================================ */
@media (max-width:760px){
  body{padding:0;font-size:14px;}
  .win{
    border-radius:0;border:none;min-height:100vh;
    box-shadow:none;
  }

  /* title bar: taller, thumb-sized buttons */
  .titlebar{height:44px;flex:0 0 44px;font-size:14px;padding:0 6px 0 10px;gap:8px;}
  .titlebar .ico{width:20px;height:20px;flex:0 0 20px;}
  .winbtn{width:34px;height:34px;font-size:15px;}

  /* the desktop menu row is decorative — hide it on a phone */
  .menubar{display:none;}

  .toolbar{padding:6px;gap:4px;}
  .tbtn{
    padding:9px 12px;font-size:14px;min-height:44px;
    border-color:#c7cede;background:#f4f7fd;
  }

  .addrbar{padding:6px;gap:6px;font-size:13px;}
  .addrbox{padding:7px 8px;font-size:13px;}

  /* Stack order on a phone: upload/new-folder, THEN the files,
     with the reference panels last so the listing is near the top.
     display:contents lifts the panels out of the sidebar so they can
     be ordered independently; if it is unsupported the panels simply
     fall back to normal source order, which is still usable. */
  .body{
    flex-direction:column;
    background:linear-gradient(180deg,#7ba2e8,#5a83d8);
  }
  .sidebar{display:contents;}
  .panel{order:1;margin:8px 8px 0;}
  .panel.tasks{order:0;}
  .panel.secondary{order:3;margin-bottom:8px;}
  .content{order:2;margin:8px;border-radius:4px;}
  .panel h4{padding:8px 10px;font-size:13px;}
  .panel ul{padding:8px 10px;}
  .panel li{margin-bottom:8px;}
  .panel a,.panel button{
    font-size:14px;padding:6px 0;display:inline-block;min-height:32px;
  }

  /* "Other Places" and "Details" are reference, not action —
     keep them but let the file list win the fold */
  .panel.secondary{order:3;}

  .content{padding:8px;}

  /* one file per row, generous tap area */
  .tiles{gap:0;}
  .tile{
    width:100%;padding:12px 10px;gap:12px;align-items:center;
    border:none;border-bottom:1px solid #e4e9f2;border-radius:0;
  }
  .tile:hover{background:#eaf1fe;}
  .tile .ic{flex:0 0 40px;width:40px;height:40px;}
  .tile .nm{font-size:15px;line-height:1.4;}
  .tile .nm > a{
    display:inline-block;padding:2px 0;min-height:30px;
    font-weight:600;color:#00309c;
  }
  .tile .sub{font-size:12px;}

  /* per-item actions become real buttons instead of 10px links */
  .tile .sub a{
    display:inline-block;margin:6px 6px 0 0;padding:7px 14px;
    min-height:38px;line-height:24px;
    border:1px solid #9db4d8;border-radius:4px;
    background:#f2f6fd;color:#14448f;text-decoration:none;font-size:13px;
  }
  .tile .sub a:hover{background:#e2ebfa;text-decoration:none;}

  /* forms: 16px stops iOS auto-zooming the whole page on focus */
  input[type=text],input[type=password],input[type=file]{
    font-size:16px;padding:9px 10px;width:100%;min-width:0;
  }
  .btn{font-size:15px;padding:11px 16px;min-height:44px;width:100%;}
  .panel .row-f{flex-wrap:wrap !important;gap:8px !important;}
  .panel .row-f input[type=text]{width:100% !important;}
  .panel .row-f .btn{width:100%;}
  /* neutralise the desktop-compact task-panel controls */
  .nf-form{flex-wrap:wrap;gap:8px;}
  .nf-input{width:100%;}
  .btn-sm{padding:11px 16px;min-height:44px;width:100%;}
  .file-input{margin-bottom:8px;padding:10px;background:#fff;
    border:1px dashed #9db4d8;border-radius:4px;}

  .statusbar{
    flex:0 0 auto;height:auto;min-height:34px;padding:6px 0;
    flex-wrap:wrap;font-size:12px;
  }
  .statusbar .cell{padding:3px 10px;border-right:none;}

  .msg{font-size:14px;padding:10px 12px;}
  .empty{font-size:14px;padding:30px 12px;}

  /* login screen fills the phone properly */
  .login-wrap{margin:0;max-width:none;}
  .login-wrap .win{min-height:100vh;}
  .login-wrap .content{padding:16px;}
  .login-field label{font-size:14px;margin-bottom:6px;}
  .login-field{margin-bottom:14px;}
  .hint{font-size:12px;}
}

/* very narrow phones */
@media (max-width:380px){
  .tbtn{padding:9px 9px;font-size:13px;}
  .tile .ic{flex:0 0 34px;width:34px;height:34px;}
}

/* ---------- share link UI ---------- */
.sharebox{margin-top:4px;}
.sharebox > summary{
  cursor:pointer;display:inline-block;color:#0b3c8c;font-size:10px;
  list-style:none;
}
.sharebox > summary::-webkit-details-marker{display:none;}
.sharebox > summary::before{content:"\25B8 ";}
.sharebox[open] > summary::before{content:"\25BE ";}
.sharebox > summary:hover{color:#e36c09;text-decoration:underline;}
.sharebox form{
  margin-top:5px;padding:7px;background:#f6f9ff;
  border:1px solid #c3d4ee;border-radius:3px;
  display:flex;flex-direction:column;gap:5px;
}
.sharebox label{font-size:10px;color:#33528f;display:block;}
.sharebox .opt{color:#8892a8;}
.sharebox select,.sharebox input[type=text]{
  width:100%;font-size:11px;padding:3px 4px;min-width:0;
  border:1px solid #7f9db9;font-family:Tahoma,sans-serif;
}

/* shares.php table */
.sharetable{border-collapse:collapse;width:100%;font-size:11px;}
.sharetable th{
  text-align:left;background:#ece9d8;border:1px solid #d5d2c2;
  padding:4px 6px;font-weight:bold;color:#333;
}
.sharetable td{border:1px solid #e6e6e0;padding:6px;vertical-align:top;}
.sharetable tr.dead{background:#faf9f7;color:#888;}
.sharetable tr.dead b{color:#777;}
.tiny{font-size:10px;color:#666;}
.warn{color:#a33;}
.ok-dot{color:#2b7a2b;font-weight:bold;}
.linkbox{
  width:230px;max-width:100%;font-size:10px;font-family:monospace;
  border:1px solid #7f9db9;padding:3px 4px;background:#fff;
}

@media (max-width:760px){
  .sharebox > summary{font-size:13px;padding:7px 0;}
  .sharebox label{font-size:13px;}
  .sharebox select,.sharebox input[type=text]{font-size:16px;padding:9px;}
  .linkbox{width:100%;font-size:13px;padding:9px;}
  /* the share table becomes stacked cards on a phone */
  .sharetable,.sharetable tbody,.sharetable tr,.sharetable td{display:block;width:100%;}
  .sharetable thead{display:none;}
  .sharetable tr{
    border:1px solid #d5d8e2;border-radius:4px;margin-bottom:10px;padding:6px;
    background:#fff;
  }
  .sharetable td{border:none;padding:5px 4px;}
  .tiny{font-size:12px;}
}
